答案:```def calculator():num1 = float(input("请输入第一个数字:"))operator = input("请输入运算符(+、-、*、/):")num2 = float(input("请输入第二个数字:"))if operator == "+":result = num1 + num2elif operator == "-":result = num1 - num2elif operator == "*":result = nu...
i = input("请输入你要输入的运算符:+,-,*,/\n") if i == "+": print("计算结果为:", + a + b) elif i == "-": print("计算结果为:", + a - b) elif i == "*": print("计算结果为:",+ a * b) elif i == "/": try: print("计算结果为:",+ a / b) except ZeroDi...
operator = input("请输入运算符(+、-、*、/):") num2 = float(input("请输入第二个数字:")) if operator == "+": result = num1 + num2 elif operator == "-": result = num1 - num2 elif operator == "*": result = num1 * num2 elif operator == "/": result = num1 / num...
print("计算结果为:",+ a / b) else: print("计算结果为:",+ a / b) else: print("输入错误") js() 方案二: def js(a,b): i = input("请输入你要输入的运算符:+,-,*,/\n") if i == "+": print("计算结果为:", + a + b) ...