2017-05-05 41 views
-3

什麼,我試圖做的是隻是簡單的+ - * /.There是原因,我寫這個我生疏和良好因爲我喜歡編程。怎麼一回事,因爲我很生疏,我會在循環和case語句然後去那麼程序文字遊戲會爲fun.here編程挑戰是鏈接,如果你想讓它programming challenge我會做,從一月的一個。ELIF python3.5.3錯誤爲什麼

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

請再具體些,以錯誤是什麼。我應該downvote這一點,但我不想浪費什麼小代表我有笑。 –

+0

@JoeD downvoting問題的成本你沒有信譽 – ifma

+0

哦,謝謝你的提示!只適用於低調回答呢? @Ifma –

回答

0

您在上面的行內缺少右括號。

變化

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

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

,你應該是好去。