0
How did they arrive at 3 as the answer?
GS: please try to give more information in future queries
6 Answers
+ 2
Once the first 'if' condition is met, the second is checked. If it is met, the third is checked. Since the second is never met, the third is never checked.
num = 7
if num >3: # yes so check next.
print("3")
if num<5: # no so don't check next.
print("5")
if num ==7:
print("7")
In general, just read the comments below the question in the module quiz you are asking about. There are always lots of explanations there.
+ 2
thomas poku Since num = 7, num > 3 is True, so "3" is printed and 'if num < 5' is checked, but since that answer is False, "5" is not printed and 'if num == 7' is not checked.
+ 1
Thanks
0
Share your code
0
shouldn't the answer be 7
0
I mean 5?