+ 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?

4th Aug 2019, 1:51 PM
Brave Tea
Brave Tea - avatar
5 odpowiedzi
+ 8
x = what_i_want while True y = input() if x = y: DoThis() break
4th Aug 2019, 1:57 PM
Mikhail Gorchanyuk
Mikhail Gorchanyuk - avatar
+ 6
This issue was asked some days ago: https://www.sololearn.com/Discuss/1906937/?ref=app
4th Aug 2019, 1:59 PM
Lothar
Lothar - avatar
+ 1
This is like guess the number game. It's possible.
4th Aug 2019, 1:56 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Lothar thanks! will look into it tonight!
4th Aug 2019, 2:03 PM
Brave Tea
Brave Tea - avatar
0
CarrieForle that is exactly what it is like! do you know how to?
4th Aug 2019, 1:59 PM
Brave Tea
Brave Tea - avatar