Text Size
Text Size
Exit Full Screen
Python Mini
Show
Source Code
View Source Code in Full Screen
Open in New Tab
from random import randint import time number = randint(1,500) yourTries = 15 while yourTries > 0: question = raw_input("Guess the random integer between 1 and 500! You have %d tries left!" % (yourTries)) question = int(question) if question > number: print "Your response, %d, is too high!" % (question) yourTries += -1 time.sleep(3) elif question < number: print "Your response, %d, is too low!" % (question) yourTries += -1 time.sleep(3) elif question == number: print "Your response, %d, is Correct!!!" % (question) break else: continue if yourTries <= 0: print "The correct answer was %d!" % (number)
ch_GuessTheNumber.py
( around 22 lines python code )
Published By:
EM5700
Published on
2019-09-25T12:43:45Z
Python Mini
- an
OYOclass
application,
own your own class today
.
Run
Result
×
Error message shows here