elif python3.5.3错误不知道为什么

时间:2017-05-05 03:10:38

标签: python-3.x

我想要做的只是简单的+ - * /。有理由我写这篇文章我生锈了,因为我喜欢编程。因为我生锈了我正在讨论循环和案例陈述然后去编写文本游戏,然后编程挑战有趣。如果你想要它的链接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")

1 个答案:

答案 0 :(得分:0)

你错过了它上面一行的右括号。

更改

print(str(FirstNumber)+ "*" + str(SecondNumber + "=" +str(answer))

print(str(FirstNumber)+ "*" + str(SecondNumber) + "=" +str(answer))

你应该好好去。