-4
        # Battle Loop

    while Battle == 1:

    # Taking users action to decide what to do

        UserAction = input("Attack, defend, run: ")

        # If the User decides to Attack
        if UserAction == "Attack" and "attack":
            print("Attacking!")

When the user enters "Attack" the message will be printed however if the user enters "attack" if will keep asking for UserAction instead of printing the message. How do I allow for the IF statement to accept two or more alternative strings?

1 Answers1

-1

You could convert the value to lower case and then you only have one comparison to make.

if UserAction.lower() == "attack":
Jim Wright
  • 5,905
  • 1
  • 15
  • 34