Make Python make sense.
Start with the first instruction, then follow each idea into the next. No fixed difficulty labels. No useless filler. Working examples you can change.
Choose a lesson.
Meet Python
Understand what Python executes, how scripts differ from the interactive prompt, and why a browser playground has limits.
Output and expressions
Find out what expressions are and why a calculation does not automatically print inside a script.
Values and types
Meet text, whole numbers, decimal numbers and booleans, and inspect their types with `type()`.
Variables and names
Store values with assignment, choose readable names and update them without confusing = with comparison.
Strings and text
Create strings, format readable messages and learn why quotation marks and backslashes matter.
Numbers and calculations
Work with arithmetic, division, rounding and the important limits of floating-point numbers.
Comparisons and boolean logic
Compare values, combine conditions and understand why Python treats some values as true or false.
Conditions and branches
Use if, elif and else to choose actions, and understand indentation and mutually exclusive branches.
For loops and range
Repeat operations with for, iterate over strings and use range without off-by-one surprises.
While loops and loop control
Use while, break and continue responsibly, and guard against accidentally endless loops.
Lists and indexes
Create and modify lists, read elements by index and loop over collections without going out of range.
Dictionaries and keyed data
Store related facts using dictionary keys, retrieve values safely and iterate through records.
Writing your first functions
Use def to group a repeatable task, call it deliberately, and keep repeated code in one place.
Parameters and arguments
Pass data into functions using parameters, arguments, keyword calls and sensible defaults.
Return values and composition
Learn why returning values differs from printing, and combine smaller functions into reusable calculations.
Scope and predictable functions
Understand function-local variables, global names, shadowing and why explicit inputs avoid surprising state.
Validation and exceptions
Recognise error types, convert input with try/except and reject invalid values with useful messages.
Modules, imports and first tests
Import standard-library modules, write basic assertions and understand how two .py files work together locally.
Cleaning and normalising text
Trim unwanted whitespace, compare text reliably and keep meaningful characters intact.
Finding, splitting and replacing text
Locate text, split fields, replace known content and preserve everything else.
Quotes, backslashes and Python literals
Understand path quotes, escaped backslashes, raw strings and safe boundary quote removal.
Accepting and validating input
Build user-input checks and learn how terminal input differs from browser demonstration code.
Paths with pathlib
Explore path names, suffixes, parents and joins without touching the local filesystem.
Practice with string functions
Combine cleaning, targeted replacement, checks and small functions through editable Python practice.
No lessons match that search. Try another topic.
Open any lesson and choose an example. Every code block is editable; Run executes Python in your browser once the runtime loads. First run downloads a pinned Python runtime, so internet access is required for the initial load. You can still read and copy code without it.