| Lab/Room | TryHackMe - Programming basics |
|---|---|
| Type | Classroom |
| Statut | Done |
| Date | 28/02/2026 |
Explore what a basic Python program looks like.
One of the most popular and friendly programming languages, Python.
Python is a high-level general-purpose programming language. By high-level, we mean it hides most implementation details; general-purpose means you can use Python for a wide variety of scenarios, from web applications and automation scripts to data science and machine learning.
In this room, we will create a “Guess the Number” game. Our plan will be as follows:
At the beginning of the program, a random secret number is generated between 1 and 20. This is done using the random.randint() function from the random module, which returns an integer within the specified inclusive range.
Several variables are initialized to manage the game state:
secret stores the randomly generated number.tries keeps track of how many attempts the user has made and is initialized to 0.