-7
我正在做一個hang子手遊戲,我希望能夠重置生活並將分數恢復到原始值(6 & 0)。此代碼似乎不起作用。如何在python中將變量重置爲其原始值?
def newwords():
newgamewords.append(input('Enter new word: '))
print('Do you want to add any more words? yes or no?')
answer=input()
if answer == 'yes':
newwords()
else:
while len(guessedletters) > 0 : guessedletters.pop()
while len(displayletters) > 0 : displayletters.pop()
lives = 6
finalscore=0
score
gamewords[:] = newgamewords
hangmangame()
這裏是在遊戲開始時的代碼(這些變量沒有任何定義,我在我的代碼中的全局作出的每一個變量只是要確定):
lives=6
score=0
顯示更多代碼請 – Will
該代碼工作正常;必須有另一個問題。 –
我懷疑你是混淆當地人與全局,但我們不能告訴這個小的信息。 –