0

How did they arrive at 3 as the answer?

GS: please try to give more information in future queries

26th Jul 2018, 3:57 PM
thomas poku
thomas poku - avatar
6 Respostas
+ 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.
26th Jul 2018, 4:11 PM
David Ashton
David Ashton - avatar
+ 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.
26th Jul 2018, 7:36 PM
David Ashton
David Ashton - avatar
+ 1
Thanks
26th Jul 2018, 8:11 PM
thomas poku
thomas poku - avatar
0
Share your code
26th Jul 2018, 4:07 PM
ᴋᵘⁿᵃˡ
ᴋᵘⁿᵃˡ - avatar
0
shouldn't the answer be 7
26th Jul 2018, 4:15 PM
thomas poku
thomas poku - avatar
0
I mean 5?
26th Jul 2018, 4:16 PM
thomas poku
thomas poku - avatar