+ 1

Input in a while loop?

how do I make it possible to let the user of my programm put in a number multiple times (loop) in the python playground?

27th Dec 2016, 12:52 PM
Sascha Lenz
Sascha Lenz - avatar
5 Respuestas
+ 1
I dont think it is possible.maybe it just doesnt work on it due to some limitation of the python playground. im not sure whether there is any solution or not,but according to my experience,i dont think so.
27th Dec 2016, 2:53 PM
YuHai
YuHai - avatar
+ 1
It depends on what you want to achieve? You can put user_input = input(":") in a while statement. The below will continue looping until quit is typed While true: User_input = input(":") Print ("options") Print ("one argument") Print ("quit") Print ("add") If user_input == "your argument": Put in here what you want the function to do Elif user_input == "quit": Break Elif user_input == "add": Num1 = float(input("enter number")) Num2 = float(input("enter another:")) Result = str(num1 + num2) Print ("the result is " + result) Else: Print ("unknown input")
28th Dec 2016, 6:43 PM
Paul Bartholomew
0
well thanks for ur response anyways :)
27th Dec 2016, 2:53 PM
Sascha Lenz
Sascha Lenz - avatar
0
sorry bro.it seems that i dont make any contribution,but maybe there is still some hope as long as we keep waiting for the real master to solve your problem.Good luck.
27th Dec 2016, 4:01 PM
YuHai
YuHai - avatar
0
thanks alot @Paul Bartholomew :)
28th Dec 2016, 6:44 PM
Sascha Lenz
Sascha Lenz - avatar