Answer:
def main():
# Initialize variables
numGuesses = 0
userGuess = -1
secretNum = 5
name = input("Hello! What is your name?")
while ( userGuess != secretNum):
userGuess = int(input("Guess a number between 1 and 20: "))
numGuesses = numGuesses + 1
if (userGuess < secretNum):
print("You guessed " + str(userGuess) + ". Too low.")
if (userGuess > secretNum):
print("You guessed " + str(userGuess) + ". Too high.")
print("You guessed " + str(userGuess) + ". The correct number is " + secretNum + " after " + numGuess + " times.")
main()
Step-by-step explanation:
add a While until userGuess == secretNum than we stop