View Single Post
  #5 (permalink)  
Old 01-19-2008, 09:46 PM
nolls nolls is offline
Newbie
 
Join Date: Jan 2008
Posts: 18
Rep Power: 3
nolls is on a distinguished road
Default

I ran into another problem. After I created a loop I chose the conditions of the loop to be if option != 0. When I did this I ran a test run and when I picked addition it would run the addition sequence over and over again. It never went back to choosing the choices.

Code:
#!/C:Python25/Calc Test.py
print "Welcome to Nolls's Calculator 1.0"

print "1. addition"
print "2. subtraction"
print "3. multiplication"
print "4. division"
print "5. exit"

option = input("Which would you like to do? ")
while option != 0:
    if option == 1:
        a = input("First number ")
        print a
        b = input("Plus second number ")
        print b
        print a + b
    elif option == 2:
        a = input("First number ")
        print a
        b = input("Minus second number ")
        print a - b
    elif option == 3:
        a = input("First number ")
        print a
        b = input("Multiplied by second number ")
        print b
        print a * b
    elif option == 4:
        a = input("First number ")
        print a
        b = input("Divided by second number ")
        print b
        print a / b
    elif option == 5:
        print "Goodbye!"
        exit ()

Any suggestions? (I appriciate all the help v0id )

Last edited by nolls; 01-19-2008 at 09:48 PM.
Reply With Quote

Sponsored Links