Your own while / else


#1

My code ran correctly, but the code in the console is wrong; the second “your guess” doesn’t allow me to enter anything. In the console, it reads: “Your guess: 6
Your guess: Your guess: 9
You lose.” I should be getting three guesses, but I only get two.


#2

Without your code we can only guess, pun intended. Is it to do with range?


#3

while guesses_left>0:
guess=int(raw_input(‘Your guess:’))
if guess==random_number:
print 'You win!'
break
guesses_left+=-1
Here’s my code.I got into the same problem.Is there any error in my code?Or this is just a bug?


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.