A simple Python game where the program picks a number from 1 to 10 and the user tries to guess it.
First Python Game: Guess the Number

What is Python?

Python is an interpreted, high-level, general-purpose language. Its clean syntax makes it ideal for beginners.

How to run Python

Install Python and run scripts with python file_name.py from terminal or an IDE such as VS Code.

Guess the number game

The computer chooses a secret number from 1 to 10, and the player tries to guess it.

Random module

import random
secret_number = random.randint(1, 10)

Main loop and input

A while loop keeps the game running while reading user input.

Conditionals and hints

Based on the distance to the secret number, the app provides warm/cold feedback.

Error handling

Using try/except ValueError prevents crashes when non-numeric input is provided.