0
door1 = input('\n\nthere are 3 doors ahead of you, \n\nwhich one do you pick? \n\n1,2 or 3.')
for char in door1:
    sys.stdout.write(char)
    sys.stdout.flush()
    time.sleep(0.1)

I am trying to get the code to slowly print the question, however I don't know how to do this when I am trying to get an input at the same time.

EggBlack
  • 3
  • 3
  • You should always search for existing questions similar to your own and read their answers _before_ asking a new one. – martineau Apr 07 '21 at 17:59

1 Answers1

0

You almost had it!

import time,sys
door1 = '\n\nthere are 3 doors ahead of you, \n\nwhich one do you pick? \n\n1,2 or 3.'
for char in door1:
    sys.stdout.write(char)
    sys.stdout.flush()
    time.sleep(0.1)
response = input()

Before, you were writing the user response the typewrite-style. You wanted to have the question written like that, so I changed door1 into you question string. Then after printing it slowly, I put the input function there.

Leander
  • 298
  • 2
  • 7