a = int(input("请输入第一个数:"))
b = int(input("请输入第二个数:"))
fuhao = input("请输入运算符号:+-*/")
if fuhao == "+":
print("%s%s%s=%s"%(a,fuhao,b,a+b))
elif fuhao == "-":
print("%s%s%s=%s"%(a,fuhao,b,a-b))
elif fuhao == "*":
print("%s%s%s=%s"%(a,fuhao,b,a*b))
elif fuhao == "/":
if b == 0:
print("除数不能是0")
else:
print("%s%s%s=%s"%(a,fuhao,b,a/b))
else:
print("符号输入有误!")
a = int(input("请输入第一个数:"))
b = int(input("请输入第二个数:"))
fuhao = input("请输入运算符号:+-*/")
if fuhao == "+":
print("%s%s%s=%s"%(a,fuhao,b,a+b))
elif fuhao == "-":
print("%s%s%s=%s"%(a,fuhao,b,a-b))
elif fuhao == "*":
print("%s%s%s=%s"%(a,fuhao,b,a*b))
elif fuhao == "/":
if b == 0:
print("除数不能是0")
else:
print("%s%s%s=%s"%(a,fuhao,b,a/b))
else:
print("符号输入有误!")
运行结果: