Ticker

6/recent/ticker-posts

Number Guessing Game in Python

Number Guessing Game in Python


This is a simple python number guessing game program.

import random

# Set up the game
print("Welcome to the guessing game!")
secret_number = random.randint(1, 10)

# Start the game loop
while True:
# Get the player's guess
guess = int(input("Enter a number between 1 and 10: "))

# Check if the guess is correct
if guess == secret_number:
print("You guessed the secret number! You win!")
break
else:
print("Wrong guess. Try again.")

Post a Comment

0 Comments