Your own while / else


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.


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


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


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