What you’ll learn
- Chapter 1print, variables & data types – Your first lines of Python.
Hallo, Python! · Variables & data types - Chapter 2Strings, numbers & input/output – Calculating, converting, reading input.
Calculating & converting - Chapter 3Conditions – if, elif, else – and indentation.
if, elif & else - Chapter 4Loops – for, while and range.
for & while - Chapter 5Lists, tuples, sets & dicts – Collecting and organising data.
Lists & dictionaries - Chapter 6Functions – Parameters, return values, default values.
Functions - Chapter 7Your code workshop – Connect what you have learned and discover a new building block.
A sum step by step - Chapter 8Workshop: understand and build it yourself – Practise new building blocks with short explanations and your own programs.
Cleaning up texts · Evaluating a list in a function · Catching errors in an input - Chapter 9New tools for your own ideas – Understand new concepts, fill them in and use them yourself.
Cleaning up and comparing text · Dictionary.get: a missing key · enumerate: position and value - Chapter 10Level up: your next practice chapter – Understand four new building blocks in small steps and use them yourself.
Tuples: keeping values together · sorted: an ordered copy · Slicing: a piece of a list · assert: checking an assumption - Chapter 11Master chapter: how real programs are built – Five building blocks from real projects – explained, connected, filled in and written by you.
List comprehension: a list in one line · zip: two lists in pairs · sorted with key: ordering by a feature · set: removing duplicate entries · Multiple return values - Chapter 12Project tools: understand and apply – Eight more building blocks with explanation pages and four exercises per lesson.
Cleaning up text input before comparing · Handling missing dictionary values with get · Building a simple word frequency · Running totals with an accumulator · Returning early from a function for invalid values · Copying a list with a slice · Checking a calculation with assert · Joining list values into one output - Chapter 13Modules & imports – Use ready-made tools from the standard library – with import, from and as.
import: loading a module · from … import: fetching specifically · as: a shorter name · Rounding: round, floor and ceil · Boss: the circle calculator - Chapter 14Error handling & debugging – Catch errors, report them yourself and find them with intermediate outputs.
try and except: catching errors · else and finally · raise: reporting an error yourself · Debugging: showing intermediate values · Boss: a safe input - Chapter 15Functions for pros – Default values, named arguments, lambdas, recursion and functions as values.
Default values for parameters · Named arguments · Lambda with sorted, map and filter · Recursion: a function calls itself · Boss: functions as tools - Chapter 17Object orientation – Classes and objects.
The first class: __init__ and self · Methods: objects can do things · __str__: printing objects nicely · Inheritance: one class extends another · Boss: a grade book made of objects - Chapter 18Testing with assert – Write your own tests, check edge cases, expect errors and build a small test run – without any extra packages.
Writing a test function · Checking edge cases · Expecting errors · A small test run · Boss: test first, then code - Chapter 23Databases with sqlite3 – Create tables from Python, change rows, read results as dictionaries and catch database errors – for real on the learning database.
Creating a table from Python · Changing and counting: UPDATE and rowcount · Reading rows as dictionaries · Catching database errors · Boss: a small grade manager
Final project: Python quiz game
A quiz with questions, evaluation and a score.
How it works
Every lesson starts with short explanation pages. Then you practise with multiple-choice questions, fill-in-the-gap tasks, putting code in order and writing your own code – with hints and instant feedback. Free, without ads, on phone, tablet and PC.