Oct-05-2019, 10:37 AM
The code gives
It currently only returns
To make it work you could change the code to only call guess once and return both
Error:TypeError: 'int' object is not subscriptable
The function guess
is called twice to get the return of wordMask
and livesLost
.It currently only returns
livesLost
(the first return it gets to)To make it work you could change the code to only call guess once and return both
wordMask
and livesLost
def guess(myWord,wordMask,lengthOfWord,livesLost): ... ... if not correct: livesLost = livesLost + 1 print("Life Lost") print(livesLost) return livesLost, wordMask # print(wordMask) # return wordMask ... ... while wordFinished == False: wordFinished = wordComplete(wordMask,myWord,lengthOfWord) # wordMask = guess(myWord,wordMask,lengthOfWord,livesLost) livesLost, wordMask = guess(myWord,wordMask,lengthOfWord,livesLost)