can someone with guessing a number
garywood
woodygar at sky.com
Wed May 21 12:42:51 EDT 2008
I would just like the program to exit after guessing the amount of numbers wrong
# Guess My Number
import random
the_number = random.randrange(100) + 1
tries = 1
# guessing loop
while (guess != the_number):
if (guess > the_number):
print "Lower..."
else:
print "Higher..."
guess = int(raw_input("Take a guess: "))
tries += 1
if tries > 10:
print 'you failed- give up'
print "You guessed it! The number was", the_number
print "And it only took you", tries, "tries!\n"
raw_input("\n\nPress the enter key to exit.")
many Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080521/cc14160e/attachment.html>
More information about the Python-list
mailing list