几天前的python新手。尝试编写一个简单的计算器程序,但是当我运行它时,当我输入'+'来选择我的运算符时,我收到SyntaxError: unexpected EOF while parsing
错误。我被困在为什么会这样,并认为这可能是由于我的空间vs标签?谁能帮我?
num1 = int(input('pick number 1: '))
num2 = int(input('pick number 2: '))
choose = str(input('Pick an operator: '))
if (choose == '+'):
print add(num1, num2)
elif (choose == '-'):
print sub(num1, num2)
elif (choose == '*'):
print mult(num1, num2)
else:
print div(num1, num2)
def div(num1, num2):
return num1 / num2
def add(num1, num2):
return num1 + num2
def mult(num1, num2):
return num1 * num2
def sub(num1, num2):
return num1 - num2