Lab/Room TryHackMe - Programming basics
Type Classroom
Statut Done
Date 28/02/2026

Context

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:

  1. The computer secretly picks a number between 1 and 20.
  2. The user keeps guessing until they get it right.
  3. The computer tells the user whether their guess is too low or too high.

Starting hypothesis

Method / Used Tools

Variables

Program Initialization

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: