Python Forum
cant get my elif function to direct me to where i want
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cant get my elif function to direct me to where i want
#1
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
Reply
#2
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'):
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Whats the right way to refactor this Big if/elif/elif ? pitosalas 1 2,244 Jul-28-2019, 05:52 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020