Resolved: Why it didn't return "Less" as output?
-3 is also less than 5, so it could return "Less"?
2 answers ( 1 marked as helpful)
In the lesson he mentioned that the python program is executed from top to bottom yeah?
So, the second line of the conditional statements
elif y < 0 already takes precedence before the
elif y < 5 so the initial 'elif' statement executes and the code ends because it has already seen a condition ...
elif y < 0: return "Negative
that satisfies the question (
I hope this helps.
Hi Amy and Oluwaseun!
Thanks for reaching out.
Thanks for sharing this piece of information with the Community!
Oluwaseun said it all. Python executes programs from top to bottom and then the order of the commands matters.
Hope this helps.
Submit an answer
can you explain why i got this error message after replacing the comma with (+)???