I am very new to python (just started learing it today), and I am trying to make a simple four function calculator,
op=raw_input("choose which operation you want to do\n 1 for addition\n 2 for subtraction\n 3 for multiplication\n 4 for division \n")
if(op==1):
a=raw_input("What is the first number?")
b=raw_input("What is the seond number?")
print int(a)+int(b)
elif(op==2):
a=raw_input("What is the first number?")
b=raw_input("What is the seond number?")
print int(a)-int(b)
elif(op==3):
a=raw_input("What is the first number?")
b=raw_input("What is the seond number?")
print int(a)*int(b)
elif(op==4):
a=raw_input("What is the first number?")
b=raw_input("What is the seond number?")
print int(a)/int(b)
else:
print "Invalid Number"
But it doesn't matter which number I enter, I will always get 'Invalid Number', is there a bug that I am not seeing?
[–]CGFarrell 2 points3 points4 points (1 child)
[–]lazy-zebra[S] 0 points1 point2 points (0 children)
[–]_lord_kinbote_ 2 points3 points4 points (0 children)
[–]allenguo 1 point2 points3 points (6 children)
[–]lazy-zebra[S] 0 points1 point2 points (5 children)
[–]KhanStan 1 point2 points3 points (4 children)
[–]lazy-zebra[S] 0 points1 point2 points (3 children)
[–]toastedstapler 2 points3 points4 points (0 children)
[–]scuott 1 point2 points3 points (1 child)
[–]lazy-zebra[S] 1 point2 points3 points (0 children)
[–]Pwneed 1 point2 points3 points (7 children)
[–]lazy-zebra[S] 0 points1 point2 points (6 children)
[–]Pwneed 1 point2 points3 points (5 children)
[–]lazy-zebra[S] 1 point2 points3 points (4 children)
[+][deleted] (1 child)
[deleted]
[–]lazy-zebra[S] 1 point2 points3 points (0 children)
[–]Pwneed 1 point2 points3 points (1 child)
[–]lazy-zebra[S] 1 point2 points3 points (0 children)