+ 1
Python If statements
The first block of code doesn't work but the second works... why is this so? the image link : https://i.stack.imgur.com/UEsM8.png
4 odpowiedzi
+ 3
First block:
X=99
99<20(false)so it doesn't enter
Second block:
Num=12
12>5(true)so it enters
+ 2
It's because the condition in first block (x is less than 20 ) is not true, hence the statements in that block won't execute, whereas the condition in second block is true (num IS greater than 5), so the code statements in that block will be executed by the compiler.
+ 1
but if executes the anyone of the if statements, it won't check the remaining statements.
it will print the true statement.
0
Thank you very much, guys.... I was thinking the other way actually....