All paths

Python from zero

Beginner Python on a Raspberry Pi: print, variables, decisions, loops, lists, functions, dicts and strings, then a button with gpiozero and a working pedestrian crossing.

Raspberry Pi 4 Model BFree7 lessons5 h4 chapters1,635 XPCoding · Beginner+100 XP

0 of 7 done

What you will build

2 projects, built step by step

7 lessons in 4 chapters, about 5 hours on a simulated Raspberry Pi 4 Model B. Free, in your browser, every step checked by the simulator.

Chapter 1 project

Decisions

if, elif and else: comparisons, True and False, and, or and not, why indentation is part of the code, and a motion alarm that decides twice a second whether to light up.

Open it in the simulator
Chapter 2 project

Dicts and strings

Dictionaries that look a value up by its name, strings you can split, clean and change, and a little command line on the Pi: type "red on" and the red light obeys.

Open it in the simulator
The map

Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

First words

Make the Pi talk, remember and decide.

  1. Open190 XP

    Print and variables

    Your first Python on a Raspberry Pi: print() to talk, variables to remember, a little math, f-strings, the three types you meet first, and an LED switched on from code.

    0 of 6 steps

  2. ProjectLocked350 XP

    Decisions

    if, elif and else: comparisons, True and False, and, or and not, why indentation is part of the code, and a motion alarm that decides twice a second whether to light up.

    0 of 6 steps

5 questions, graded as you go.
Chapter 2

Repeat and organize

Loops, lists, functions and dicts: the tools every program is made of.

  1. Locked190 XP

    Loops and lists

    for and range, lists you can index and grow, a list of real LEDs lit one after another, while loops that run forever, and break to stop one when the job is done.

    0 of 6 steps

  2. Locked175 XP

    Functions

    def to name a few lines and run them by name, parameters and defaults, return to hand a value back, functions that choose a light, and why a value goes in and comes out instead of being shared.

    0 of 6 steps

  3. ProjectLocked380 XP

    Dicts and strings

    Dictionaries that look a value up by its name, strings you can split, clean and change, and a little command line on the Pi: type "red on" and the red light obeys.

    0 of 6 steps

5 questions, graded as you go.
Chapter 3

Touch the world

Read a button properly, with gpiozero.

  1. Locked175 XP

    Reading a button with gpiozero

    A pushbutton on GPIO21: asking with is_pressed, why a pull-up keeps the pin from floating, waiting for a press, contact bounce, header pin numbers, timeouts, and callbacks that run when it happens.

    0 of 6 steps

4 questions, graded as you go.
Chapter 4

Boss project

A pedestrian crossing built from everything in the course.

  1. Locked175 XP

    Project: traffic lights

    The boss project: a pedestrian crossing on the traffic light module and a button, built from everything in the course: a phase function, the sequence as a list, a loop waiting on the button, a counter and a flashing amber.

    0 of 6 steps

4 questions, graded as you go.
Syllabus

Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

First words

  1. Print and variablesYour first Python on a Raspberry Pi: print() to talk, variables to remember, a little math, f-strings, the three types you meet first, and an LED switched on from code.
  2. Decisionsif, elif and else: comparisons, True and False, and, or and not, why indentation is part of the code, and a motion alarm that decides twice a second whether to light up.
Chapter 2

Repeat and organize

  1. Loops and listsfor and range, lists you can index and grow, a list of real LEDs lit one after another, while loops that run forever, and break to stop one when the job is done.
  2. Functionsdef to name a few lines and run them by name, parameters and defaults, return to hand a value back, functions that choose a light, and why a value goes in and comes out instead of being shared.
  3. Dicts and stringsDictionaries that look a value up by its name, strings you can split, clean and change, and a little command line on the Pi: type "red on" and the red light obeys.
Chapter 3

Touch the world

  1. Reading a button with gpiozeroA pushbutton on GPIO21: asking with is_pressed, why a pull-up keeps the pin from floating, waiting for a press, contact bounce, header pin numbers, timeouts, and callbacks that run when it happens.
Chapter 4

Boss project

  1. Project: traffic lightsThe boss project: a pedestrian crossing on the traffic light module and a button, built from everything in the course: a phase function, the sequence as a list, a loop waiting on the button, a counter and a flashing amber.
Keep going

The next course on your track

Python from zero is part of the coding track, a ladder of courses from zero to expert.

Next course

C++ on a board

The language, one idea per lesson, on a board that shows you what your code did.

Open the next course
Track

Coding track

Python and C++ from your first print to classes, tests and state machines. Every program runs on a simulated board, so a bug is something you can see.

See every course on the track
Kits

Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.

See every kit
Questions

About Python from zero

Is Python from zero free?

Yes. All 7 lessons of Python from zero are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Raspberry Pi 4 Model B?

No. Every lesson runs on a simulated Raspberry Pi 4 Model B with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Python from zero take?

About 5 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Decisions and Dicts and strings.

Where do I start?

With "Print and variables", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.