[Idle-dev] Unsolved problem.
Mark Fenton
bradfenton1 at optusnet.com.au
Sat Aug 16 13:50:02 CEST 2008
Hi,
Does anyone know how to do the following:
# HiLo.py
import random
z = random.randint(1, 100)
loopy = 0
countdown = 15
while loopy < 15:
loopy = loopy + 1
countdown=countdown-1
print
guess = int(raw_input('Enter an integer: '))
print
print "[Countdown %i]" % (countdown)
print "-" * 89
print
if guess < z:
print "[Go higher]".rjust(94)
if guess > z:
print "[Go lower]".rjust(94)
if guess == z:
print
print "At last!"
print "If you want to play again press 'r' then enter, otherwise 'x' then enter to exit"
run = raw_input("\n'r' to run again or 'e' to exit ")
if run == "e":
print "Bye till next time..."
break
elif run == "r":
continue
if countdown == 0:
print "Looks like you've run out of turns..."
print "If you want to play again press 'r' then enter, otherwise 'x' then enter to exit"
run = raw_input("\n'r' to run again or 'e' to exit ")
if run == "e":
print "Bye till next time..."
break
elif run == "r":
z = random.randint(1, 100)
loopy = 0
countdown = 15
continue
Save the above as HiLo.py in site packages then put a shortcut onto desktop and when it's double - clicked it comes up NOT in a black dos window but as it would if one were to run it from the IDLE i.e., white background with blue characters.
Does anyone know how to do this?
Thanks in advance,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/idle-dev/attachments/20080816/20e2b1fd/attachment.htm>
More information about the IDLE-dev
mailing list