PLEASE HELP I HAVE NO IDEA HOW TO DO THIS AND I WILL MARK BRAINLIEST!!!!!!!

i need to fill in the missing code and every time i try to it says it’s wrong

here is the code and it tells you where i need to fill in:

def main():
# Initialize variables
numGuesses = 0
userGuess = -1
secretNum= 5

name = input("Hello! What is your name?")


# Fill in the missing LOOP here.
# This loop will need run until the player has guessed the secret number


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.")



# Fill in missing PRINT statement here,
# Print a single message telling the player:
#That he/she guessed the secret number
#What the secret number was
#How many guesses it took
main

Respuesta :

My Coding:

def main():

  num_guesses = 0

  secret_num = 5

  name = input("Hello! What is your name? ")

  while True:

      user_guess = int(input("Guess a number between 1 and 20: "))

      if user_guess == secret_num:

          num_guesses += 1

          break

      elif user_guess < secret_num:

          num_guesses += 1

          print("You guessed {}. That was too low!".format(user_guess))

      elif user_guess > secret_num:

          num_guesses += 1

          print("You guessed {}. That was too high!".format(user_guess))

  print("The secret number was {}. You guessed it correctly in {} tries".format(secret_num, num_guesses))

if __name__ == "__main__":

  main()

Have a great day <3

ACCESS MORE