# Create a guessing game about your name, make the user have three tries only and end the game if the user cannot guess the answer in three tries.
answer = "jay"
guess = ""
guess_count = 0
guess_limit = 3
out_of_guesses = False
while guess.lower() != answer and not out_of_guesses:
if guess_count < guess_limit:
guess = input("What's my name? ")
guess_count += 1
else:
out_of_guesses = True
if out_of_guesses:
print("You lose. ")
else:
print("You win. ")
I assigned a variable called out_of_guesses in this case; however, the while statement should use the not keyword and reverse the variable out_of_guesses to True. This isn't the case however because if the not keyword reversed the second condition to True then it would not exit the loop when out_of_guesses was True. Basically, what I'm asking is how does the while loop read the not statement? Am I misunderstanding something and how?