If statements | SoloLearn: Learn to code for FREE!


If statements

num=7 If num>3: Print(“3”) If num <5: Print(“5”) If num ==7: Print(“7”) Answerr >>> 3 Why not >>> 3 7

9/30/2018 2:56:36 PM


5 Answers

New Answer


If the first condition is True, the first indented code block is executed, so "3" is printed and the second condition is evaluated. Since the second condition is False, the second indented code block is not executed, so "5" is not printed and the third condition is not evaluated so "7" is never printed. btw make sure you don't capitalize "if" and "print" 😉


Because of the indentation, 3rd if is part of 2nd if. And both depend on 1st. This would give you 3 and 7. num = 7 if num > 3: print(“3”) if num < 5: print(“5”) if num == 7: print(“7”)


fente post your code here.


it writes 3 because it is first


I did not write code