Post

@PythonPr Answer: 1
Solution: We have num=75, and then an if-elif ladder.
We meet the first if-condition. Is num<= 50? No.
So we must skip that block and see the next elif condition.
Is num<=75? Yes!
So this block is run. Printed 1.
Now, do we have to check any more elifs?
+
English

@PythonPr No.
Once an if or elif condition is satisfied and it's block executed...
python breaks out of the if-elif ladder.
So the further elif conditions are not checked,
there is no chance of executing any of their blocks.
Think of it as checking conditions till you find a true
+
English

@PythonPr and skipping everything else in the if-elif ladder.
Thus, after printing the 1, the condition
num <= 80
is never checked, nor is its block executed.
So, 2 does NOT get printed (although the condition would have been True if it had been checked)
So, the output is just 1.
English

