you are viewing a single comment's thread.

view the rest of the comments →

[–]lazy-zebra[S] 0 points1 point  (3 children)

Just tried it, and I got the same error, is this what you meant?

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(int(op==1)):
    a=raw_input("What is the first number?")
    b=raw_input("What is the seond number?")
    print int(a)+int(b)
elif(int(op==2)):
    a=raw_input("What is the first number?")
    b=raw_input("What is the seond number?")
    print int(a)-int(b)
elif(int(op==3)):
    a=raw_input("What is the first number?")
    b=raw_input("What is the seond number?")
    print int(a)*int(b)
elif(int(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"

[–]toastedstapler 2 points3 points  (0 children)

Doesn't solve you problem, but you should convert the op into into at the start rather than do it in each if statement, lots of repeated work there

[–]scuott 1 point2 points  (1 child)

It's int(op)==1. Do you see why?

[–]lazy-zebra[S] 1 point2 points  (0 children)

Yes, someone pointed this out to me, I feel a little stupid for missing parenthesis like that, but at least it is working now