If-elif-else statement not working in simple Python 3.3 class?
My code is:
def nameAndConfirm():
global name,confirm
print("What is your name? ")
name = input()
str(name)
print("Is",name,"correct? ")
confirm = input()
str(confirm)
print(confirm)
if confirm.upper() == "Y" or "YES":
classSelection()
elif confirm.upper() == "N" or "NO":
nameAndConfirm()
else:
print("Valid answers are Y/Yes or N/No!")
nameAndConfirm()
nameAndConfirm()
Critique on this code would be nice as well. I know its very shifty, I
know how to make it shorter in some ways but I was trying to get my
if-elif-else to work. I have no clue what else I can do as I've tried
everything I know. Also I made an indent 4 spaces in the above code.
No comments:
Post a Comment