import random
# Pick a random number between 1 and 10
secret = random.randint(1, 100)
# Start with no guesses yet
guess = None
tries = 0
print("I'm thinking of a number between 1 and 100...")
# Keep looping until the player guesses correctly
while guess != secret:
guess = int(input("Take a guess: "))
tries += 1 # add 1 to the number of tries
if guess == secret:
print("🎉 You got it!")
elif guess < secret:
print("Too low! Try again.")
else:
print("Too high! Try again.")
# After the loop ends, show how many tries it took
print("You guessed it in", tries, "tries!")