Python Forum

Full Version: If-Else statements issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello there ,
first of all i'm all new to this language , and all my knowledge this far in computing comes from C .

my issues are with this code lines :
----------------------------------------------------
answer=input("would you like to proceed Y/N ? ")

if answer == "N" or "n" :
    print("too bad ,thank you {} see you again ".format(users_name))
elif answer == "Y" or "y":
    print("great !")     
----------------------------------------------------
the problem is , by getting from the users "Y" or "y" the condition that happens is the first one , which should happen by getting "N" or "n" .more then that, by getting some other char that is not N,n,Y,y the result is again the first messege .
putting Parenthesis: answer == ("N" or "n") doesnt completly solve the problem .
what's wrong with those lines ? is it a syntax problem ?
how do i solve it ? Tongue
thank you so much !