if statements in idle python39 do not function properly

You are almost there. Your indentation for the elif is wrong. Python is very particular about the indentation. You are currently doing:

if x < 0:
    x = 0
    print('Negative changed to zero')
    elif x == 0:
    print('Zero')

Instead you should do:

if x < 0:
    x = 0
    print('Negative changed to zero')
elif x == 0:
    print('Zero')

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top