Small proram troble
Patio87
patio87 at aol.com
Mon Sep 3 19:38:01 EDT 2001
I have a problem with this simple program but im very new to python and this is
the biggest program i have written. Now I think the problem is the while loop
but im not sure if someone could take a look at this it would be apprecitaed
choice = 0
def print_options():
print "Options:"
print "'1' Print Options"
print "'2' Add numbers"
print "'3' Subtract numbers"
print "'4' Multiply number"
print "'5' Divide number"
print "'6' Exit"
while choice != 6:
print_options()
while choice != 6:
choice = raw_input("What would thou like to do?")
if choice == "1":
print_options()
elif choice == "2":
add = input("What number would you like to add?")
add2 = input("What other number do you want to add?")
print "The awnser is", add + add2
elif choice == "3":
sub = input("What number do you want to subtract?")
sub2 = input("What 2nd number do you want to subtract?")
print "Your awnser is,", sub + sub2
elif choice == "4":
mul = input("What number do you want to multiply")
mul2 = input("What 2nd number do you want to multiply")
print "Your multiplicated number is", mul * mul2
elif choice == "5":
div = input("What is your dividend?")
div2 = input("What is your numerator?")
print "Your awnser is", div/div2
elif choice == "6":
print "thanks for using my program"
exit
More information about the Python-list
mailing list