我在Python開始了,只是寫了一個簡單的計算器,但它似乎有一些errors.Pls幫我出錯誤計算器程序蟒蛇
a = raw_input("Enter value of a : ")
b = raw_input("Enter value of b : ")
sum = a + b
sub = a - b
mul = a * b
div = a/b
print"1.Addition"
print"2.Subtraction"
print"3.Multiplication"
print"4.Division"
op = raw_input("Enter the operation to be done : ")
if op == 1:
print"Sum is %d" % sum
elif op == 2:
print"Difference is %d" % sub
elif op == 3:
print"Product is %d" % mul
elif op == 4:
print"Quotient is %d" % div
else:
print"Invalid operation"
錯誤是 類型錯誤:不支持的操作數類型 - :'str'和'str'
你也可以做浮動()的原始輸入到一個int轉換成什麼樣的輸入你期待 – user7091717