Skip to main content

Tutorials

Programming, data structures, systems and AI. Each topic is one page with worked examples you can run.

Popular:
Showing 32 topics

Python

11 topics
Conditionals: if, elif and else

Making decisions in Python: if, else and elif chains, truthy and falsy values, combining conditions, nesting versus flat logic, and the conditional expression.

35 min
Dictionaries and Sets in Python

Key-value lookup with dictionaries: creating, reading safely, updating, iterating, counting and grouping, nested records and comprehensions. Then sets for uniqueness, fast membership and set algebra.

45 min
Errors and Exceptions in Python

Reading tracebacks, the common exception types, handling errors with try, except, else and finally, raising your own exceptions, and writing programs that survive bad input.

40 min
Files and Modules in Python

Reading and writing text files safely with with, working with CSV and JSON, handling paths, importing from the standard library, and splitting your own program into modules.

45 min
Functions in Python

Defining and calling functions, parameters and return values, default and keyword arguments, scope, docstrings, functions as values, lambda, *args and **kwargs, and a first look at decorators.

50 min
Introduction to Python

What Python is, how the interpreter runs a program from top to bottom, and how to write, run and read your first programs with print(), comments and input().

30 min
Lists and Tuples in Python

Ordered collections in Python: creating and changing lists, searching and sorting, aliasing and copying, list comprehensions, nested lists, and immutable tuples with unpacking.

50 min
Loops in Python: while and for

Repeating work with while and for loops: range(), accumulator patterns, break and continue, the loop else clause, nested loops, and enumerate() and zip().

45 min
Operators and Expressions in Python

Arithmetic, floor division and modulo, precedence, augmented assignment, comparisons and the logical operators, plus the floating-point behaviour every programmer has to know.

35 min
Variables and Data Types in Python

How Python variables name values, the core built-in types (int, float, str, bool and None), converting between them, and formatting values with f-strings.

40 min
Working with Strings in Python

Text in Python: string literals and escapes, indexing and slicing, immutability, the most useful string methods, and splitting and joining text.

40 min