Learn Python
Learn programming fundamentals with Python. 20 published lessons, with practice code and topic activities.
Start the first lesson- 01
Python Values, Names and Output
Predict printed output, distinguish numeric and string values, and explain assignment and execution order.
- 02
Python Types and Explicit Conversion
Convert intentionally before an operation that requires a different kind of value.
- 03
Python Strings, Indexing and Slicing
A slice excludes its stop position and returns a new string.
- 04
Python Operators and Comparisons
Assignment binds a name; comparison evaluates a relationship between values.
- 05
Python Conditions and Indentation
Only the first matching branch of one if/elif/else chain executes.
- 06
Python Loops and Range
range excludes its stop value, and a running total must be initialised before iteration.
- 07
Python Lists and Mutation
Assignment shares the same list reference; a shallow copy creates a separate outer list.
- 08
Python Tuples and Unpacking
Tuple unpacking binds names to sequence items; a single-item tuple needs a comma.
- 09
Python Dictionaries and Key Lookup
Dictionary membership checks keys, and get can supply an explicit missing-key fallback.
- 10
Python Sets and Membership
A set stores distinct members, not a promised display order or indexed sequence.
- 11
Python Functions and Return Values
return supplies a value to the caller; print only displays a value.
- 12
Python Parameters, Defaults and Scope
Use a fresh collection inside the call instead of a mutable default shared between calls.
- 13
Python Comprehensions
The comprehension expression transforms each included item; its trailing condition filters inputs.
- 14
Python Exceptions and Recovery
Catch a specific expected failure and make recovery explicit rather than hiding unrelated errors.
- 15
Python Modules and Imports
Importing a module provides a namespace; it does not make every external package or system capability available.
- 16
Practical Python Standard-Library Tools
Choose a standard-library tool according to its input/output contract and preserve meaningful data.
- 17
Python JSON and Bounded File Handling
JSON parsing constructs data, not executable source, and parsed records still need validation.
- 18
Python Classes and Instances
Instance attributes assigned through self belong to that instance rather than an implicitly shared mutable class collection.
- 19
Python Tests and Debugging
Test normal cases, boundaries and expected failures; a passing test does not prove all possible behaviour.
- 20
Python Project: Build a Revision Planner
Validate session records and keep pure calculations separate from report formatting.