I'm doing 'guess the word' on Python and I can't figure out this error.
AttributeError: 'int' object has no attribute 'index' (python)
It is giving me an error on the line letterIndex=word.index(guess).
def checkLetter(word):
blanks = '_' * len(str(word))
print('Word: ', blanks)
if str(guess) == str(letters):
letterIndex = word.index(guess)
newBlank = blanks[:letterIndex * 2] + guess + blanks[letterIndex * 2 + 1]
print('Guess Corrrect')
wordis an integer. Integers do not have the methodindex. So you go through your code and search for the place where you definewordas an integer.