def oper(parm_one, parm_two):
operator = input('请输入要执行的运算符: + - * /' + '\n')
if operator == '+':
return "计算的结果为:" + str(parm_one+parm_two)
elif operator == '-':
return "计算的结果为:" + str(parm_one-parm_two)
elif operator == '*':
return "计算的结果为:" + str(parm_one*parm_two)
elif operator == '/':
if parm_two == 0:
print('除数不能是零')
else:
return "计算的结果为:" + str(parm_one/parm_two)
else:
return "非法运算符"
num_one = int(input('请输入第一个数:'))
num_two = int(input('请输入第二个数:'))
oper(num_one , num_two) #自定义的函数