Python can automate small tasks, process files, and power larger applications. Start by making one small program run reliably. This course uses Python 3.12 or newer and the standard library, the modules included with Python. You do not need a web framework, account, or paid service. The existing Python overview remains useful as a quick reference.
Work through the lessons in order. Read an example, predict its output, run it, then change one input. Later lessons combine these habits into a command-line study tracker that stores validated JSON on your computer.
Identify the interpreter
The interpreter is the program that executes Python code. Install Python using the instructions for your operating system in the official setup guide. On Linux, your distribution may provide the interpreter and its venv support as separate packages.
Open a terminal. On macOS or Linux, run:
python3 --version
On Windows, try:
py -3 --version
Check that the reported version meets the course baseline. A computer can have several interpreters. If the default is older, select your newer installation explicitly when creating the environment; installing another version does not guarantee that every command changes.
The terminal runs operating-system commands. By comparison, running Python with no filename opens an interactive prompt, often called a REPL: read, evaluate, print, loop. Enter 2 + 3 there to see 5, and use exit() to return to the terminal. Do not paste terminal commands after Python's >>> prompt.
Create a project environment
A virtual environment keeps a project's installed packages separate from other projects. It uses an existing Python installation; it does not download a different Python version or isolate the whole operating system. The venv reference explains this separation.
In a macOS or Linux terminal using Bash or Zsh:
mkdir python-course
cd python-course
python3 -m venv .venv
source .venv/bin/activate
python --version
python -m pip --version
The equivalent PowerShell sequence is:
mkdir python-course
cd python-course
py -3 -m venv .venv
.\.venv\Scripts\Activate.ps1
python --version
python -m pip --version
If PowerShell blocks activation, invoke .\.venv\Scripts\python.exe directly instead of changing a machine-wide security setting. On macOS or Linux, the direct path is .venv/bin/python. Activation is a convenience that changes command lookup in the current shell. It is not required to use the environment.
Confirm which executable you selected:
python -c "import sys; print(sys.executable)"
The path should point inside .venv. Configure your editor to use that same interpreter. This prevents the common situation where a script runs in the terminal but the editor cannot find its packages.
Run your first file
Create hello.py in the project directory, outside .venv:
name = "Asha"
minutes = 25
print(f"{name} studied Python for {minutes} minutes.")
Run python hello.py. It prints Asha studied Python for 25 minutes. The leading f makes the string interpolate, or insert, the values between braces. Save the file after editing; Python executes the saved contents, not an unsaved editor tab.
The -m option runs an importable module as a program. Using python -m pip ties the package installer to this interpreter. These lessons require no package installation. When a future project needs dependencies, follow the packaging guide inside its environment. Keep dependency records with the project; pip freeze describes an installed environment but is not a complete cross-platform lockfile.
Pitfalls and practice
Keep source code and useful data out of .venv, and exclude that directory from version control. Recreate environments when moving a project rather than copying them. Run deactivate to leave an activated environment; your project files remain.
Exercise: change the script to show 40 minutes, then run it from a new terminal. Explain why the new terminal might select a different Python.
Solution guidance: save minutes = 40, enter the project directory, and activate the environment again or use its executable path. Check sys.executable before running the file. The output should change only the minute count. You have succeeded when you can identify the interpreter, locate the source file, and repeat the run without relying on an already-open editor.

