Python Forum
Using Input() in If...Elif Statements
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Input() in If...Elif Statements
#9
Well, what I want to happen is, when the user types hunt, they encounter a slime. When they type heal, they restore their health; the print statements represent those actions. I have the while loop so that they can heal or hunt more than once. If they do not type either hunt or heal, it will do the else statement, then they can type hunt or heal. However, what is happening is, when I store the input in a variable, and I check if that variable equals either hunt or heal, they can type hunt and encounter a slime. If they type heal, however, it goes straight to the else statement, and seems to skip the elif statement. Any advice?
Reply


Messages In This Thread
Using Input() in If...Elif Statements - by Shemira - Nov-23-2019, 04:53 PM
RE: Using Input() in If...Elif Statements - by Shemira - Nov-23-2019, 05:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Whats the right way to refactor this Big if/elif/elif ? pitosalas 1 2,888 Jul-28-2019, 05:52 PM
Last Post: ichabod801
  an input error or elif error , how can i fix this the_fire_pharaoh 1 2,977 Dec-15-2018, 09:47 PM
Last Post: Gribouillis
  Unexpected input within an if/elif statement fier259 2 3,809 May-12-2018, 07:41 AM
Last Post: buran
  input issue elif jge047 2 3,951 Nov-23-2017, 06:29 AM
Last Post: zykbee

Forum Jump:

User Panel Messages

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