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


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


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


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


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


Lothar thanks! will look into it tonight!


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