OPENVIST LEARN · FREE LESSONS
Python foundations: from your first line to a tested CLI
Twenty-two practical beginner lessons: Python values, decisions, collections, functions, classes, files, JSON, CSV, command-line arguments and tests, ending with a small validated JSON reporting tool.

What you will build
Learn to write and explain small Python programs, then combine them into a command-line report with validation and automated tests. Work locally or in a practice VPS; renting a server is optional.
The reference environment is Python 3.12 on Ubuntu 24.04. Source examples also use standard Python on macOS and Windows. Shell commands are labelled Bash; Windows users use the interpreter guidance in lesson 1. No external Python packages or paid API are needed.
Allow roughly 7–10 hours including exercises, and repeat topics at your own pace. Each Python code block is a complete example unless explicitly identified as a project file. The final project has source downloads, expected results and regression tests.
This is a complete foundations route, not the whole Python language: web frameworks, databases, concurrency, packaging for distribution and production deployment are later topics. Being able to predict, explain and test your result matters more than finishing quickly.
Your learning path
- LESSON 1 · 15 MIN
Meet Python and run your first program
Separate Python source from terminal commands, choose an interpreter and run a saved file.
- LESSON 2 · 20 MIN
Names, values and readable programs
Store values, reuse them and explain intent without hiding it in cryptic names.
- LESSON 3 · 20 MIN
Numbers, types and conversion
Work with integers and decimals while recognising that text containing digits is still text.
- LESSON 4 · 20 MIN
Strings, slicing and clean display
Read and transform text without confusing formatting with data validation.
- LESSON 5 · 20 MIN
Read a value and check it
Accept a small interactive input and handle a bad conversion with a useful message.
- LESSON 6 · 20 MIN
Decisions with if, elif and else
Express a rule as readable branches and understand indentation.
- LESSON 7 · 20 MIN
Lists, tuples and shared values
Keep related values together and see the difference between changing a list and copying it.
- LESSON 8 · 20 MIN
Loops, counting and stopping
Repeat work over a sequence without losing track of what changes each time.
- LESSON 9 · 20 MIN
Dictionaries, sets and missing values
Use names for fields, count categories and distinguish a missing key from a stored value.
- LESSON 10 · 20 MIN
Transform collections without hiding the rule
Build a new collection concisely and understand when an iterator is consumed.
- LESSON 11 · 20 MIN
Functions, return values and scope
Give a repeated rule a name, accept arguments and return a result you can test.
- LESSON 12 · 25 MIN
Classes and simple data objects
Group related state and behaviour without turning every function into a class.
- LESSON 13 · 20 MIN
Errors, tracebacks and useful failures
Find the failing operation and handle only errors you understand.
- LESSON 14 · 20 MIN
Modules, imports and entry points
Move a small rule into another file and keep imports from unexpectedly running your CLI.
- LESSON 15 · 20 MIN
Paths and text files without accidental overwrites
Read UTF-8 text, understand relative paths and create a new practice file deliberately.
- LESSON 16 · 25 MIN
JSON and checking the shape of data
Decode a JSON document and verify its structure before using fields.
- LESSON 17 · 20 MIN
CSV rows, headers and quoted fields
Read tabular text without splitting it incorrectly at every comma.
- LESSON 18 · 25 MIN
Command-line arguments and exit codes
Turn an interactive idea into a repeatable command with a help screen.
- LESSON 19 · 20 MIN
Virtual environments and dependency choices
Keep a project’s packages separate and recognise when no package installation is needed.
- LESSON 20 · 25 MIN
Automated checks with unittest
Turn expected behaviour into repeatable checks, including edge cases.
- LESSON 21 · 40 MIN
Project: build a bounded JSON reporting tool
Combine the earlier lessons into a useful local program with an explicit contract.
- LESSON 22 · 30 MIN
Project: test failures and connect a real recipe
Prove a small set of useful behaviours and decide what remains outside the tool’s scope.
