perators = {"+": lambda x, y: x + y,
"-": lambda x, y: x - y,
"*": lambda x, y: x * y,
"/": lambda x, y: x / y}
op = input("请输入运算符(+、-、*、/):")
num1 = float(input("请输入第一个数字:"))
num2 = float(input("请输入第二个数字:"))
result = operators[op](num1, num2)
print("计算结果:", result)
标签:num1,num2,float,计算器,result,简单,input,lambda From: https://www.cnblogs.com/zmxpython/p/17334809.html