19
Lesson 44 of 44

Projects

Put everything you have learned into practice with complete projects. In this lesson you will learn how to go from a problem to a program, how to organise code into functions, classes and modules, and how to build small applications: a contact book, a log analyzer, an expense tracker, an inventory control, a data validator, a game, a unit converter and a test bench.

  • 3 theory articles
  • 16 practice exercises
Start lesson

Fundamentals concepts 3

From a problem to a program

You already know the tools: variables, conditions, loops, functions, classes, files, exceptions... A project consists of…

Theory
Read more

A project solved step by step

We are going to build a contact book bit by bit, the way a programmer would: first the minimum that works and then we add pieces…

Theory
Read more

Structure and good practices

When a program grows, the way you organise it matters as much as what it does. These practices save you time and errors, and make…

Theory
Read more

Practice exercises 16

Contact book project

Create a Python program that manages a contact book stored in a dictionary (name → phone). It is the first mini-project: organise…

Exercise Medium
Solve it

Log analyzer

Create a Python program that analyses an application log using regular expressions and counters, and shows a summary.

Exercise Medium
Solve it

Expense tracker

Create a Python program that manages a list of expenses using an enumeration for the categories and a dataclass for each expense.

Exercise Hard
Solve it

Inventory control

Create a Python program that controls a shop inventory with its own class and a custom exception for insufficient stock.

Exercise Hard
Solve it

CSV to JSON validator

Create a Python program that reads CSV data, validates each row and exports the valid ones to JSON , reporting the errors.

Exercise Hard
Solve it

Guessing game

Create a Python program that simulates a number guessing game. To make it testable, the secret number and the guesses are read…

Exercise Medium
Solve it

Unit converter project

Create a Python program that converts units of length, mass and temperature using factor tables in dictionaries and a conversion…

Exercise Medium
Solve it

Test bench

Create a Python program that works as a mini test bench : define three functions and automatically check a list of test cases.

Exercise Hard
Solve it

Tic-tac-toe with AI

Program the move of an automatic player in tic-tac-toe . The strategy is simple but effective: win if it can, block if the…

Exercise Hard
Solve it

Bank with OOP and exceptions

A bank with classes ( Account and Bank ) and its own exception hierarchy : each possible error is a subclass of a base error, and…

Exercise Hard
Solve it

Library with SQLite

Manage a library's loans by storing the books in an in-memory SQLite database. Use queries with parameters ( ? ), do not…

Exercise Hard
Solve it

Text adventure

An adventure game is represented with data: a dictionary of rooms with their exits and another with the objects of each room. The…

Exercise Hard
Solve it

Markdown to HTML converter

Build a converter from a subset of Markdown to HTML combining line-by-line reading, state and regular expressions.

Exercise Hard
Solve it

Calculator with a parser

A real calculator does not use eval : it parses the expression. Split the text into tokens and write one function per precedence…

Exercise Hard
Solve it

To-do list with JSON

A to-do list that persists in a JSON file: at the start it loads the file if it exists and at the end it saves it.

Exercise Hard
Solve it

The game of life

Conway's game of life is a cellular automaton: each cell is alive or dead and its state in the next generation depends only on…

Exercise Hard
Solve it