Loop input() input, how to? | SoloLearn: Learn to code for FREE!

+2

Loop input() input, how to?

What I would like to do is: if input == what_i_want: DoThis() if input != what_i_want: StartOverAndAskForInputAgain() And this of course without exiting the programme And having to run it again. Ie within one run In essence I want the user to keep having to input different inputs until they get the correct one. Is this even possible?

8/4/2019 1:51:17 PM

Brave Tea

5 Answers

New Answer

+8

x = what_i_want while True y = input() if x = y: DoThis() break

+6

This issue was asked some days ago: https://www.sololearn.com/Discuss/1906937/?ref=app

+1

This is like guess the number game. It's possible.

+1

Lothar thanks! will look into it tonight!

0

CarrieForle that is exactly what it is like! do you know how to?