#### Function secondLoop has the same components with the additional lines #
number = len(sentence)
while number != 0 #While flag==True
letter = input("Enter letter: ")
# letter is asked in function again
if letter not in enteredLetters:
find = sentence.find(letter)
if find == -1:
print("Letter is not in word")
# flag = False
enteredLetters,newSentence,lettersInWord = secondLoop(enteredLetters,sentence,newSentence,lettersInWord)
else:
newSentence = ""
lettersInWord.append(letter)
for char in sentence:
if char in lettersInWord:
newSentence = newSentence + char
else:
newSentence = newSentence + "_ "
number = newSentence.count("_")
#flag = True
elif letter in enteredLetters:
print ("The letter has been used")
#flag = False
enteredLetters,newSentence,lettersInWord = secondLoop(enteredLetters,sentence,newSentence,lettersInWord
print (newSentence)
enteredLetters.append(letter)
This is a guess game that changes between two players and when it changes to second player it doesnt work for some reason. Any ideas why