我想要做的只是简单的+ - * /。有理由我写这篇文章我生锈了,因为我喜欢编程。因为我生锈了我正在讨论循环和案例陈述然后去编写文本游戏,然后编程挑战有趣。如果你想要它的链接programming challenge我要去从1月开始做这个。
FirstNumber=0
SecondNumber=0
MathOP=" "
answer=0
#I know caluater spelled incorrectly its I will get to that later
print("python caluater")
FirstNumber=input("enter your first number")
MathOP=input(" + , - , * or / ")
SecondNumber=input("enter your second number")
if MathOP=="+":
answer==FirstNumber+SecondNumber
print(str(FirstNumber) + "+" + str(SecondNumber) + "=" +str(answer))
elif MathOP=="-":
answer=FirstNumber-SecondNumber
print(str(FirstNumber) + "-" +str(SecondNumber) + "=" + str(answer))
elif MathOP=="*":
answer=FirstNumber*SecondNumber
print(str(FirstNumber)+ "*" + str(SecondNumber + "=" +str(answer))
elif MathOP=="/":
answer=FirstNumber/SecondNumber
print(str(FirstNumber )+ "/" + str(SecondNumber) + "=" +str(answer))
else:
print("congrats you broke me")
答案 0 :(得分:0)
你错过了它上面一行的右括号。
更改
print(str(FirstNumber)+ "*" + str(SecondNumber + "=" +str(answer))
到
print(str(FirstNumber)+ "*" + str(SecondNumber) + "=" +str(answer))
你应该好好去。