+ 1
Python IF condition
What is the output of this code? num = 7 if num > 3: print("3") if num < 5: print("5") if num ==7: print("7") shouldn't that give 2 outputs? 3 and 7?
1 Answer
+ 2
No.
Firstly it asks if num > 3 and it is true.
Then it asks if num < 5, and it is false. Because the third if is inside the second if, it is not going to run.
So, the only output is 3