0
why is this thing happens ?
What is the output of this code? num = 7 if num > 3: print("3") if num < 5: print("5") if num ==7: print("7") it says the ans is 3 but in the last line it says if num ==7: print("7") num = 7 the ans should be 7 then why it says 3
3 odpowiedzi
+ 4
Hi
In up code it first check the condition num > 3 which is ture . That's why it print 3. If tne statement num==7 is written brfore this statement it prints 7. This is the reason. Hope this will help you😊
+ 3
num is not < 5, so from that line onwards the code is not executed.
+ 1
7 < 5 is False so the code below this if never gets executed.