Python Forum
Stop if statement from running
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Stop if statement from running
#4
@KieranPage
The if statements don't do as expected because of the or, see the following link
Multiple expressions with "or" keyword

note rather than checking for various case you could just turn the input into lowercase.
action = input('Fight or Run')
action = action.lower()

if action == 'fight':
    ...
@tonytech
That's great that you got the code working but note you have added duplication of code for each outcome
Reply


Messages In This Thread
Stop if statement from running - by KieranPage - May-05-2020, 03:41 PM
RE: Stop if statement from running - by tonytech - May-05-2020, 04:01 PM
RE: Stop if statement from running - by stullis - May-05-2020, 04:04 PM
RE: Stop if statement from running - by Yoriz - May-05-2020, 04:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  If/Else If Statement Not Running new_coder_231013 5 1,741 Dec-10-2021, 10:16 AM
Last Post: new_coder_231013
  May i ask how i can stop my coding running christing 4 2,620 Oct-03-2019, 12:25 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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