Make a loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Make a loop?

how do I make a loop (like in a betting game) that repeatively asks the user to enter a guess?

27th Dec 2016, 12:21 PM
Sascha Lenz
Sascha Lenz - avatar
14 Answers
+ 1
This is working code : while ('true'): x = int(input("Enter")) // please make indentation corret
27th Dec 2016, 12:56 PM
Lavish Thomas
Lavish Thomas - avatar
+ 1
ok got it, the problem is the program i gave will run forever. But playground allows you to enter the input only once, it is getting error , second time it is asking for input.
27th Dec 2016, 1:21 PM
Lavish Thomas
Lavish Thomas - avatar
0
while (true) {.... }
27th Dec 2016, 12:37 PM
Lavish Thomas
Lavish Thomas - avatar
0
thx first but idk y but it shows no input no more...
27th Dec 2016, 12:40 PM
Sascha Lenz
Sascha Lenz - avatar
0
var input = input("enter ")
27th Dec 2016, 12:41 PM
Lavish Thomas
Lavish Thomas - avatar
0
put that inside while loop
27th Dec 2016, 12:42 PM
Lavish Thomas
Lavish Thomas - avatar
0
one sec ill try
27th Dec 2016, 12:42 PM
Sascha Lenz
Sascha Lenz - avatar
0
invalid syntax
27th Dec 2016, 12:44 PM
Sascha Lenz
Sascha Lenz - avatar
0
which version u using ?
27th Dec 2016, 12:45 PM
Lavish Thomas
Lavish Thomas - avatar
0
python3 in the playground
27th Dec 2016, 12:45 PM
Sascha Lenz
Sascha Lenz - avatar
0
while ('true'): something = input("Enter random number : ")
27th Dec 2016, 12:51 PM
Lavish Thomas
Lavish Thomas - avatar
0
I think you should start with basics of python before jumping to actual coding
27th Dec 2016, 12:51 PM
Lavish Thomas
Lavish Thomas - avatar
0
while ('true'): something = input("Enter random number : ") i did exactly that (except i used x=int(input()) bc i need it to be an integal) and it would not work
27th Dec 2016, 12:54 PM
Sascha Lenz
Sascha Lenz - avatar
0
i know that this works on regular python3 but im on vocation so i have to use my mobile and it says EOFError: EOF when reading the line
27th Dec 2016, 1:00 PM
Sascha Lenz
Sascha Lenz - avatar