Small proram troble
Ignacio Vazquez-Abrams
ignacio at openservices.net
Mon Sep 3 19:59:13 EDT 2001
On 3 Sep 2001, Patio87 wrote:
> 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
Yikes. Here's my fixed version:
---
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()
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
print "thanks for using my program"
---
--
Ignacio Vazquez-Abrams <ignacio at openservices.net>
More information about the Python-list
mailing list