Untitled
unknown
plain_text
a year ago
580 B
1
Indexable
Never
import random # Generate a random number between 1 and 100 number = random.randint(1, 100) print("Welcome to the Guessing Game!") print("I'm thinking of a number between 1 and 100. Try to guess it!") # Set the initial number of attempts attempts = 0 # Game loop while True: guess = int(input("Enter your guess: ")) attempts += 1 if guess < number: print("Too low, try again!") elif guess > number: print("Too high, try again!") else: print(f"Congratulations! You guessed the number {number} in {attempts} attempts!") break