0

Why this answer

Num=7 If num >3: Print(“3”) If num<5: Print (“5”) If num==7: Print (“7”) Why would the output of this be 3 instead of 7? Is it because it is also true and higher in the chain of if statements?

16th Aug 2019, 6:36 PM
Sam Hatchard
Sam Hatchard - avatar
1 Resposta
+ 2
because it jumps out of the nesting of the if statements the moment it hits true. and because your num is bigger than 3 it simply says, okay, and prints “3”
16th Aug 2019, 6:38 PM
Brave Tea
Brave Tea - avatar