Codington

Python exercises

Write and run Python in your browser, from your first expression to a small program.

0 of 120 exercises completed

0%
No account needed · Progress saved in this browser
Start practising

Part 1

Foundations

Calculate with numbers, format text with f-strings, and convert values between types.

Beginner · 3 modules

Module 1

Numbers and Variables

Display a message, name values, and divide a quantity into whole groups.

0 of 6 completed
Start
Module 2

Strings and Formatting

Clean text, take slices, and insert values into readable labels.

0 of 6 completed
Start
Module 3

Values and Conversion

Convert text explicitly and distinguish numbers, strings, and booleans.

0 of 6 completed
Start

Part 2

Conditions and Functions

Choose a branch with if and elif, return a result, and combine small functions.

Beginner · 3 modules

Module 4

Conditions and Branching

Use comparisons and select a single branch with if, elif, and else.

0 of 6 completed
Start
Module 6

Composing Functions

Split a calculation into helpers and pass the result of one call to the next.

0 of 6 completed
Start

Part 3

Sequences and Loops

Unpack tuples, slice lists, visit their items with for, and repeat steps with while.

Beginner · 3 modules

Module 8

Lists and Slices

Select items from ordered sequences, take slices, and construct new lists.

0 of 6 completed
Start
Module 9

Repetition

Repeat a fixed number of steps or keep going until a condition changes.

0 of 6 completed
Start

Part 4

Dictionaries and Sets

Look up and update values by key, then use sets to count or compare unique items.

Beginner to intermediate · 2 modules

Module 10

Dictionaries

Look up values by key and update quantities in a dictionary.

0 of 6 completed
Start
Module 11

Sets

Track distinct values, detect first occurrences, and compare membership.

0 of 6 completed
Start

Part 5

Data Processing

Write comprehensions to transform values and group records to summarize a dataset.

Intermediate · 2 modules

Module 12

Comprehensions

Express transformations and filters with Python comprehensions.

0 of 6 completed
Start
Module 13

Grouping Records

Read lists of records and group their values into useful summaries.

0 of 6 completed
Start

Part 6

Practical Python

Handle exceptions, calculate statistics, and work with dates using the standard library.

Intermediate · 2 modules

Module 14

Handling Exceptions

Handle failed conversions and reject invalid values with meaningful exceptions.

0 of 6 completed
Start

Part 7

Files and Data Formats

Read and write text files, load JSON documents, and process rows from CSV files.

Intermediate · 3 modules

Module 16

Text Files

Read, write, and process UTF-8 files in the browser's temporary filesystem.

0 of 6 completed
Start
Module 17

JSON Data

Decode, encode, and edit structured settings with Python's json module.

0 of 6 completed
Start
Module 18

CSV Tables

Read and write tabular data with headers, quoting, and numeric conversions.

0 of 6 completed
Start

Part 8

Projects

Build a stock report and summarize weather records using the skills from earlier parts.

Intermediate · 2 modules

Module 19

Project: Stock Report

Turn a shop's inventory counts and deliveries into a restocking report.

0 of 6 completed
Start
Module 20

Project: Weather Records

Clean temperature measurements and export a daily weather summary.

0 of 6 completed
Start