0

why this if statements are no output 7?

num = 7 if num > 3: print("3") if num < 5: print("5") if num == 7: print("7") Output result is just only 3 but i think that num is same at 7 so output 3 and 7

20th Dec 2018, 5:12 AM
하인철
하인철 - avatar
2 Answers
0
Python uses indentation instead of curly braces. https://www.sololearn.com/learn/Python/2277/?ref=app (In yellow box below) The if num == 7 is in if num < 5 And because num < 5 is false num == 7 is not executed.
20th Dec 2018, 5:16 AM
Gordon
Gordon - avatar
0
aha thx
20th Dec 2018, 5:17 AM
하인철
하인철 - avatar