这段代码,为什么在guess错误后,没有运行六次?

importrandom
secret=random.randint(1,100)
guess=0
tries=0
print"AHOY!I'mtheDreadPirateRoberts,andIhaveasecret!"
print"Itisanumberfrom1to99.I'llgiveyou6tries."
whileguess!=secretandtries<6:
guess=input("What'syerguess?")
ifguessprint"Toolow,yescurvydog!"
elifguess>secret:
print"Toohigh,landlubber!"
tries=tries+1
ifguess==secret:
print"Avast!Yegotit!Foundmysecret,yedid!"
else:
print"Nomoreguesses!Betterlucknexttime,matey!"
print"Thesecretnumberwas",secret
MMTTMM
浏览 555回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript