0
My else statement is always executing even when True. How to fix?
print('Guess a letter!') a = True def checkGuess(): guess = input().lower() if guess == True: print ('Correct! You win!') else: print ('Wrong') [checkGuess() for _ in range(0,3)] while checkGuess == True: break
1 ответ
+ 3
You're comparing a String to a Boolean. Convert the String to a Boolean or compare the input to a String.
Example/
guess = bool(input())
OR
if guess == 'True'
(In this case you will still need to remove .lower())