R
Rÿffffe9veillÿffffe9
Hello,
I have just started doing the python tutorials and i
tried to modify one of the exercises, it has to to
with defining functions.
I wanted the user to be able to enter an option and
then get a print of the selected option. I also wanted
to have an exit for the user.
This is the code....
def PU():
print 'To have a ...'
def Python():
print 'To create a programme ...'
def overall():
print 'To make .....'
def motv():
print 'I know you can do it!'
def menu():
print ' GOALS IN... '
print '____________________'
print '1.Pick up'
print '2.Python Programming'
print '3.Overall'
print '4.Motivation'
print '5.Exit'
print '____________________'
menu()
while choice != 5:
choice = input ('Pick a number:')
if choice == 1:
PU()
elif choice == 2:
Python()
elif choice == 3:
overall()
elif choice == 4:
motv()
else:
print 'Bye'
The problem is that it doesnt print the
[ choice = input ('Pick a number:') ]
command. It just runs thru the whole thing without
allowing the user a selection.
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
I have just started doing the python tutorials and i
tried to modify one of the exercises, it has to to
with defining functions.
I wanted the user to be able to enter an option and
then get a print of the selected option. I also wanted
to have an exit for the user.
This is the code....
def PU():
print 'To have a ...'
def Python():
print 'To create a programme ...'
def overall():
print 'To make .....'
def motv():
print 'I know you can do it!'
def menu():
print ' GOALS IN... '
print '____________________'
print '1.Pick up'
print '2.Python Programming'
print '3.Overall'
print '4.Motivation'
print '5.Exit'
print '____________________'
menu()
while choice != 5:
choice = input ('Pick a number:')
if choice == 1:
PU()
elif choice == 2:
Python()
elif choice == 3:
overall()
elif choice == 4:
motv()
else:
print 'Bye'
The problem is that it doesnt print the
[ choice = input ('Pick a number:') ]
command. It just runs thru the whole thing without
allowing the user a selection.
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250