Learn Python for free, explained simply.
Beginner-friendly Python lessons that start with the basics, build real understanding, and grow toward practical projects — with exercises you run right in your browser.
PYLI5 (Py Like I'm 5) is a free site that teaches Python from scratch in plain English. Every idea is explained simply first, then shown in real code you can run in your browser, no installs, no jargon, no cost.
A clear path, from first steps to real projects
Beginner · Units 1–3
Unit 1 | The Absolute Basics
Install Python, then variables, data types, strings, and numbers.
Unit 2 | Logic, Loops, and Data Structures
if statements, loops, lists, dictionaries, and reusable functions.
Unit 3 | Errors, Files, and Real Projects
Handle errors, read and write files, and build projects you can actually use.
Intermediate · Units 4–6
Unit 4 | Object-Oriented Python
Classes, objects, inheritance, and special methods.
Unit 5 | Practical Scripting and Automation
Command-line tools, file automation, testing, and reproducible projects.
Unit 6 | Web Apps with Flask
Routes, templates, forms, and a tiny notes app.
Advanced · Units 7–16
Unit 7 | Working with APIs and JSON
Call web services, parse JSON, and serve data of your own.
Unit 8 | Databases and Text Patterns
Store data with SQLite, and pull structure out of messy text with regular expressions.
Unit 9 | Code That Holds Up
Logging, deliberate error handling, type hints, and dataclasses.
Unit 10 | Python Power Features
Iterators, itertools pipelines, decorators, and context managers.
Unit 11 | Doing Many Things at Once
Thread pools, async/await, and why threads never speed up a calculation.
Unit 12 | Data Science Basics
NumPy, pandas DataFrames, cleaning messy data, and charts you can run in the browser.
Unit 13 | Machine Learning Basics
Regression, classification, train/test splits, and your first scikit-learn model.
Unit 14 | Games and Desktop Apps
Event loops, Pygame, Tkinter, and separating logic from display.
Unit 15 | Debugging, Testing, and Shipping
Debugging, pytest, clean code, packaging an installable tool, CI, and containers.
Unit 16 | What to Learn Next
Choose a path, meet the features past this course, and ship your capstone.
Featured lessons
-
What Is Python?
What Python is, what programming actually means, why Python is so popular, and what you can (and can't) build with it.
-
Variables
What variables really are (names bound to values, not boxes), assignment and reassignment, naming rules and good style, and the = vs == trap.
-
if Statements
How if/elif/else let a program choose what to do, how conditions are evaluated as True/False, comparison and boolean operators, and how indentation defines a block.
-
Lists
Creating lists, indexing and slicing, adding and removing items, common methods, looping over lists, and what 'mutable' means.
-
Functions
Defining functions, parameters and arguments, return values, default and keyword arguments, why functions matter, and the difference between printing and returning.
-
Common Python Errors
The everyday errors, SyntaxError, NameError, TypeError, ValueError, IndexError, KeyError, IndentationError, what each means, and how to fix them quickly.
-
Classes and Objects
What a class and an object really are, how __init__ and self work, and why a class can be tidier than juggling several loose dictionaries.
-
How Websites Use Python
The browser/server model in plain terms: what an HTTP request and response are, how dynamic pages differ from static ones, what a web framework does, and what “localhost” really means.
-
APIs Explained Simply
What an API actually is, how endpoints, requests and responses fit together, why JSON is the usual answer, and what status codes tell you.
-
Pandas DataFrames: Tables in Python
The DataFrame as a whole table in one object: building one, reading CSV, head(), selecting columns, filtering rows with conditions, and grouped summaries.
-
What Machine Learning Really Means
Machine learning without the mystique: features and labels, rules written by humans versus patterns learned from data, where it genuinely helps, and why evaluation is not optional.
-
Packaging: Turn Your Script Into an Installable Tool
The last step of the roadmap: the src layout, a pyproject.toml explained line by line, console entry points that make your tool a real command, pip install -e ., building a wheel, and a plain account of what publishing to PyPI involves.
Practice right in your browser
Every Try-It exercise runs real Python in your browser, no installs, no setup. Edit the code, click Run, and see the result instantly.
Build mini-projects
-
Number Guessing Game
Build a complete, replayable guessing game and learn the “keep asking until the input is valid” pattern that powers every interactive program.
-
To-Do List CLI
Build a menu-driven to-do app that remembers your tasks between runs. Your first program that saves and loads its own data.
-
CSV Cleaner
Turn a messy spreadsheet export into a tidy one. A real command-line tool that reads a CSV, cleans it, and writes the result to a new file.
Practical recipes
Short, real-world scripts that put the lessons to work, the kind of small automation you'd actually reach for. Each one is a complete build with sample data and downloadable code.
-
Search and Summarize a Log File
Turn a 9,000-line log into a three-line summary: scan it line by line, keep only the errors, count them by type, and write a report — the everyday shape of an ops or security script.
-
Safely Rename Files in Bulk
Rename a folder full of messily-named files to a clean, numbered scheme — with a dry-run that shows exactly what will happen before a single file is touched.
-
Compare Two CSV Reports
Find what changed between two spreadsheet exports. Match records by ID, detect additions, removals, and changed fields, then generate a concise summary and detailed CSV reports.
Advanced builds
Bigger projects that join several units together, the way real work does: pull data from an API and store it, turn a messy export into a report, or package a script into a tool other people can install. Each is a full build with sample data and downloadable code.
-
From Messy Export to One-Page Report
Take a real, untidy sales export and turn it into a report someone would actually read: clean the columns, group the numbers, join a lookup table, chart the result, and write a conclusion that admits what the data cannot say.
-
Collect API Data Into a Database
Turn a one-off API call into a tracker that remembers. Flatten a nested JSON response into clean records, give them a shape with a dataclass, store them safely in SQLite without ever duplicating a row, and query the history back out.
-
Package and Ship a Command-Line Tool
Take a script that only runs in its own folder and turn it into a real tool: the src layout, a pyproject.toml, an entry point that makes it a terminal command, tests, a CI workflow, and a wheel you can hand to someone.
-
Build a Utility Toolkit You Will Reuse
Stop rewriting the same three helpers. Build a small helpers module with a timing decorator, a retry that survives flaky calls, a cache that skips repeated work, and a context manager that always cleans up, then reuse it in every project after this one.