0

I'm making one of those really old text games.

I give the player two options.

  1. Run.
  2. Stay.

I let them choose like this:

Run = input("Do you:
                     1. Run
                     2. Stay.")

Then, an if statement saying if they choose option:

  1. then more stuff prints. else if,
  2. then more stuff prints.

Then we get to my problem.

If they enter something other than choice 1 and 2, then I want it to repeat the question until they finally choose either option 1 or 2.

James K
  • 3,692
  • 1
  • 28
  • 36

1 Answers1

0

I'd recommend a while loop like so:

while Run not in ["Run", "stay", "1", "2"]:
    Run = input("not an option, try again:")
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Elliot Roberts
  • 910
  • 5
  • 10