if guess in word:
if guess == word[0] and 1 >= len(word):
print("Your guess is correct. The letter of the word you guess has been revealed. ")
right[0] = word[0]
print(' '.join(right))
score +=1
if guess == word[1] and 2 >= len(word):
print("Your guess is correct. The letter of the word you guess has been revealed. ")
right[1] = word[1]
print(' '.join(right))
score +=1
print(score)
if guess == word[2] and 3 >= len(word):
print("Your guess is correct. The letter of the word you guess has been revealed. ")
right[2] = word[2]
print(' '.join(right))
score +=1
print(score)
if guess == word[3] and 4 >= len(word):
print("Your guess is correct. The letter of the word you guess has been revealed. ")
right[3] = word[3]
print(' '.join(right))
score +=1
print(score)
if guess == word[4] and 5 >= len(word):
print("Your guess is correct. The letter of the word you guess has been revealed. ")
right[4] = word[4]
print(' '.join(right))
score +=1
print(score)
The error is: if guess == word[1] and 2 >= len(word): IndexError: string index out of range
I think the problem is with the and in the if statement but I dont know.