Python is a general-purpose language known for readable code. It is used for automation, data analysis, web back-ends, AI and teaching. Install the latest Python 3 from python.org (on Windows, tick "Add python.exe to PATH"). Check it with python --version (on macOS/Linux the command may be python3).
Typing python alone opens the interactive shell (REPL), where each line runs immediately — perfect for experiments. Type exit() to leave.
For real projects, create a virtual environment: a private folder of packages for that project, so different projects don't clash. Create it once with python -m venv .venv, activate it, then install packages with pip.
python --version
mkdir hello-python && cd hello-python
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activatefrom datetime import date
name = "Dolese"
year = date.today().year
print(f"Hello, {name}! Welcome to Python in {year}.")python hello.pyKey points
- Use Python 3 — Python 2 is long retired.
- The REPL is for quick experiments;
.pyfiles are for programs you keep. - One virtual environment per project keeps dependencies isolated.
Exercise
Create about.py that stores your name, age and school in variables and prints one sentence about yourself using an f-string. Then open the REPL and use it as a calculator: what is 2 ** 10, 17 // 5 and 17 % 5?
Show solution
Try the exercise yourself first — then compare your approach with this one.
An f-string builds the sentence from the three variables. In the REPL, ** is "to the power of", // is whole-number division and % is the remainder.
name = "Amina"
age = 17
school = "Azania Secondary"
print(f"My name is {name}, I am {age} years old and I study at {school}.")>>> 2 ** 10
1024
>>> 17 // 5
3
>>> 17 % 5
2