[Solved] Python if elif code


It’s because the input() function takes string input.

Either convert the input into int using int() function

OR

if x == '1':
    # your stuffs

elif x == '2':
   # your stuffs

The problem is your last condition: elif >=0 because no matter which integer I type it’s always greater than 0 isn’t it? Thus, it’s calling the the last condition. Review and apply your logic correctly.

2

solved Python if elif code