输入两个数和一个符号,完成两个数的+ - * / % // **
num1 = float(input(“请输入第一个数:”))
num2 = float(input(“请输入第二个数:”))
a = input(“请输入运算符:”)
if a == “+”:
print("%s + %s = %s"%(num1 , num2 , (num1 + num2)))
elif a == “-”:
print("%s - %s = %s"%(num1 , num2 , (num1 - num2)))
elif a == “*”:
print("%s * %s = %s"%(num1 , num2 , (num1 * num2)))
elif a == “/”:
print("%s / %s = %s"%(num1 , num2 , (num1 / num2)))
elif a == “%”:
print(num1 , “%” , num2 ,"=","%s"%(num1 % num2))
elif a== “//”:
print("%s // %s = %s"%(num1 , num2 , (num1 // num2)))
elif a== “**”:
print("%s ** %s = %s"%(num1 , num2 , (num1 ** num2)))
else:
print(“您的输入有误,请重新输入!”)