[Tutor] One of my 'baby step' programs
Alan Gilfoy
agilfoy at frontiernet.net
Mon Oct 2 03:51:50 CEST 2006
-code block-
number = 3
running = True
while running:
guess = int(raw_input("Please enter a number : ")) #lets user guess a number
if guess == number:
print "Yay, you got the right number, good for you. But you
don't get any prizes. Do I look like a walking ATM to you?"
running = False #this causes the guess-again loop to start.
elif guess < number:
print "No, my number is higher than that"
else:
print "No, my number is lower than that."
else:
print "The number-guessing loop is over."
print "Done."
-end code block-
Darnit, it's very simple, but I still like the fac tthat is does
something to user input.
More information about the Tutor
mailing list