the full guide

Python projects

A project is a complete small program that combines several skills and solves a real task. Unlike an exercise, you decide its structure, so you practise the judgement that tutorials can't teach.

120 min Intermediate

What you need: The earlier topics of this module.

Definition

A project is a complete small program that combines several skills and solves a real task. Unlike an exercise, you decide its structure, so you practise the judgement that tutorials can't teach.

In simple words

Exercises are scales on a guitar, and projects are playing a whole song. You'll get stuck, search and fix things, and that's exactly what the job is like.

Why it matters

Projects are what convince employers, and they're where the separate topics finally connect in your head.

How it works

ProjectUsesLevel
Calculator with historyFunctions, loops, filesBeginner
To-do list saved to JSONLists, dicts, JSONBeginner
Quiz game with scoresClasses, files, randomBeginner
File organiser by typepathlib, shutilIntermediate
Expense tracker with a chartCSV, pandas, MatplotlibIntermediate
Weather client using an APIrequests, JSON, errorsIntermediate
Tool that publishes to PyPIargparse, tests, packagingAdvanced

How to do one well

  1. Build the smallest version that works.
  2. Add one feature at a time, testing as you go.
  3. Use Git from the first day.
  4. Write a README with what it does and how to run it.

In code

A starting point for the to-do project. Add saving to a file, and marking items done.

todo.py
tasks = []

def add(task):
    tasks.append({"title": task, "done": False})

def show():
    for number, task in enumerate(tasks, start=1):
        mark = "x" if task["done"] else " "
        print(f"{number}. [{mark}] {task['title']}")

add("Learn loops")
add("Build a project")
tasks[0]["done"] = True
show()

Output

1. [x] Learn loops
2. [ ] Build a project

Common mistakes

  • Starting with a huge idea and never finishing. Finish small things.
  • Following a tutorial step by step and calling it your project. Change it, and add something of your own.

Check yourself

Question 1

1. What should you build first?

Question 2

2. What makes a portfolio project convincing?

Summary

  • Projects combine skills on a real task.
  • Start small, and finish it.
  • Use Git, and write a README.

Finished reading?