[Tutor] need a little help

Glen Wheeler wheelege@hotmail.com
Tue, 1 Jan 2002 05:15:46 +1100


  What your looking for is a loop - in this situation I think a while loop
would be best.  Is there a quit option in your menu?  Here is a little bit
of python...

print 'Hi, please enter 1 to print slime mould, 2 to quit'
while 1:
    choice = raw_input('> ')
    if choice == '1':
        print 'slime mould'
    elif choice == '2':
        print 'bye!'
        print "That's not a 1 or 2 :)"


----- Original Message -----
From: "Oliverio Sierra" <oliveriosierra@hotmail.com>
To: <tutor@python.org>
Sent: Monday, December 31, 2001 5:09 PM
Subject: [Tutor] need a little help

> hi, i just downloaded and started studying python a few days ago. it's
> the first language i have studied. i am currently writing my first
> semi-complicated(at least for me) program and i hit a dead end.  my
> goes a little like this:
> -there is a menu with 3 choices
> -then a user = input() statement
> -then an if, 2 elif, and an else statements
> i can go into any of the 3 choices, but only once. i need to be able to go
> into them several times. i have read everything i could find on the net,
> had no succes.  i know there is a way for the program to cycle back to
> my user = input() statement is.  i apreshiate your help and time. thank
> _________________________________________________________________
> Hable con sus amigos en línea, pruebe MSN Messenger:
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor