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

Thanks, got past that problem!

Now I did a test run everything was fine, except that it doesn't go back and re-run it! And I remembered I had to create a loop. I vaguely remember the "while" loop and forget the other. Any suggestions?
Code:
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? ")
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 ()
Reply With Quote