python - I can't make my elif statement work after using input -


so i'm making quick text based application , made guess @ doing this. want program accept input user , create different outcomes when user inputs direction. going if no matter type. took shot in dark , code.

print ("would go left or right?") input() if ("left"):     print ("welcome cleanliness room *squeak!*.")     print ("would go forward,or backwards?") elif ("right"):     print ("inhale dong enragement child.")     print ("game over") 

input() returns result, ignored , nothing happened it. if ("left"): asks if string "left" not empty. indeed not empty.

store return value of input() in new variable, test variable equality ==:

print ("would go left or right?") answer = input() if answer == "left":     print("welcome cleanliness room *squeak!*.")     print("would go forward,or backwards?") elif answer == "right":     print("inhale dong enragement child.")     print("game over") 

you want peruse python tutorial more.


Comments

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -