Python Forum

Full Version: cant get my elif function to direct me to where i want
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i've been trying to make a text based adventure game using python and im stuck. im trying to use an elif command to direct me to a part of the game affected by the users decision however it doesnt direct me to the right place. ive tried to change the elif into an if and an else but it still hasnt worked. ive tried to change the name of the path its supposed to direct me to.

elif firstpath == "bookstore" or firstpath == "BOOKSTORE":
patH2()

edit: i fixed it nvm
When worried about case use upper() or lower()
elif firstpath.upper() == 'BOOKSTORE':
To test if a string matches one of multiple choices use in
elif firstpath.upper() in ('BOOKSTORE', 'BOOKSHOP'):