python - Variable inputs within an IF creating a bank. -


i'm new python , doing work if statements. have far...

print("hello") myname = input("what name?") print("hello " +myname) myage = int(input("how old you?")) if myage <=18:     myresponse = input("you must still @ school?")     if myresponse == "yes" or "yes" or "yes" or "y" or "yes" or "y":         myschool = input("what school go to?")         print (myschool, "that school hear")     if myresponse == "no" or "n" or "n" or "no":         print("lucky you, have lots of free time!") if myage >=19:     myresponse = input("you must have job?")     if myresponse == "yes" or "yes" or "yes" or "y" or "yes" or "y":         mywork = input("what do?")         print (mywork, "thats tough job")     if myresponse == "no" or "n" or "n" or "no":         print("lucky you, have lots of free time!") 

i want user able answer question 1 word answer have various options recognized program example "no", "no" , "no" or "yes", "yes" , "yes".

i have figured out way of doing seen above there better way should done?

bare in mind new silly question. appreciated.

si

this condition checks myrespone either yes or "y" , case insensitive (meaning yes, yes, , others valid)

myresponse.lower() in ["yes","y"] 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -