Skip to content Skip to sidebar Skip to footer

How To Fix Python Restarting Whenever I Start Program On Idle Environment?

import random winning_conditon = 0 no_of_guesses = 0 comp_guess = random.randint(1,100) while (no_of_guesses == 11) or (winning_conditon == 1): user_guess = int(input('What i

Solution 1:

When I run your program I get this output:

Python 3.2.5 (default, May 152013, 23:06:03) [MSC v.150032 bit (Intel)] on win32
Type "copyright", "credits"or"license()"for more information.
>>> ================================ RESTART ================================
>>> 
You haven't guessed the right amount of times or u won.
>>> 

This is perfectly fine and expected.

I would modify your program this way:

whilenot(no_of_guesses == 11 or winning_conditon == 1)

while not would be the equivalent of until.

Post a Comment for "How To Fix Python Restarting Whenever I Start Program On Idle Environment?"