0

Why isn't it 7?

What is the output of this code? num = 7 if num > 3: print("3") if num < 5: print("5") if num ==7: print("7"

26th Jun 2018, 11:19 AM
Gregorys Mode
Gregorys Mode - avatar
1 Answer
+ 7
because all the if statements are nested and therefore will not execute as the second condition isn't met. fixed code: if num < 3: print(3) elif num < 5: print(5) elif num == 7: print(7)
26th Jun 2018, 11:38 AM
hinanawi
hinanawi - avatar