Structured Python course
A free, structured path from your first print() call to classes and error handling. Every lesson includes runnable code, clear explanations, and a link to the browser compiler.
Set up your mental model and run your first programs.
Learn what Python is, why it is popular, and how to run your first Python program directly in your browser with ILoveCompiler.
Learn how to display text and values with print(), control separators and line endings, and document code with comments.
Read text and numbers from standard input, understand prompts, and design programs that handle supplied input cleanly.
Numbers, strings, types, and the values you use every day.
Understand variables, assignment, dynamic typing, and the core built-in types: str, int, float, bool, and None.
Work with integers and floats, use arithmetic operators, understand precedence, and avoid floating-point surprises.
Create strings, access characters, take slices, use escapes, and explore common string operations.
Convert between strings, integers, and floats safely, and understand which conversions can fail.
Use True and False, comparison operators, and logical operators to build conditions.
Make decisions and repeat work with conditions and loops.
Control program flow with conditions, nested branches, and clear boolean expressions.
Repeat code until a condition changes, avoid infinite loops, and use counters and sentinels safely.
Iterate over strings, lists, ranges, and other iterables with Python's for loop.
Generate number sequences with range and track positions with enumerate while iterating.
Control loop execution with break and continue, and learn how the rarely used loop else clause works.
Store and organise data with lists, tuples, dictionaries, and sets.
Store ordered collections in lists, access items by position, iterate over them, and use slicing and unpacking.
Modify lists with append, extend, insert, remove, pop, sort, reverse, and understand which methods return None.
Use tuples for fixed groups of values, unpack them cleanly, and know when a tuple is a better choice than a list.
Store and retrieve key-value data with dictionaries, iterate over items, and use get, update, and comprehensions.
Remove duplicates with sets, test membership quickly, and use union, intersection, difference, and symmetric difference.
Package logic into reusable, testable functions.
Write reusable code with def, pass arguments, return results, and use docstrings to document behaviour.
Use positional and keyword arguments, default values, *args, **kwargs, and avoid mutable default pitfalls.
Understand local, global, and nonlocal scope, when variables are created, and why modifying globals inside functions is risky.
Model state and behaviour with classes and objects.
Handle errors and work confidently with real programs.
Reading is only part of learning. Work through exercises with automatic tests, study complete example programs, and build one of the guided projects.