我無法在我的python測驗代碼中輸入評分。下面是該腳本:輸入評分(python 2.7.5)
#This is the Test script for)TUKT(, Developed by BOT.
print ""
print "Welcome to the Ultimate Kirby Test."
print ""
begin = (raw_input("Would you like to begin?:"))
if begin == "yes":
print ""
print "Alright then! Let's start, shall we?"
print "Q1. What color is Kirby?"
print "1) Black."
print "2) Blue."
print "3) Pink."
print "4) Technically, his color changes based on the opponent he swallows."
choice = input("Answer=")
if choice ==1:
print "Incorrect."
print ""
elif choice ==2:
print "Incorrect."
print ""
elif choice ==3:
print "Tee hee.... I fooled you!"
print ""
elif choice ==4:
score = score+1
print "Well done! You saw through my trick!"
print ""
elif choice > 3 or choice < 1:
print "That is not a valid answer."
print ""
print "Well done! You have finished my test quiz."
print("Score:")
print ""
#End of Script
錯誤總是說 得分=得分+ 1沒有定義。 我沒有得到任何研究。 謝謝!非常感謝幫助!
在腳本開始處設置'score = 0'。 – Hyperboreus
謝謝你們!這真的回答了我的問題! – boatofturtles