Source: https://mokxi.com/learn/learn-python-free
Updated: 2026-11-11

Coding track
Learn Python

# Learn Python free, with code that lights things up

Beginner to real habits on a simulated Raspberry Pi: print and loops first, then classes, exceptions, logging and tests, with LEDs and buttons to show it working.

Free In your browser 2 courses, 14 lessons, about 11 hours

Start free Print and variables See the course

Overview

## How you will learn it

Python is the most popular first language for a reason: it reads close to plain English and it is used everywhere, from web servers to data science to the Raspberry Pi. These courses teach it on a simulated Pi with gpiozero, so your program does something you can see.

Python from zero starts with print and variables and ends with traffic lights you code yourself. Python with real habits picks up there with modules, classes, exceptions, files, tests and generators, ending in a sensor logger.

Outcomes

## What you will learn

- Write programs with variables, decisions, loops, lists, functions, dicts and strings.
- Read a button and drive LEDs on a Raspberry Pi with gpiozero.
- Organize code into modules and classes, and handle errors with exceptions.
- Log to a file and check your code with tests.

Your route

## The courses and lessons to take

Every lesson opens in the editor right away, signed in or not, and the simulator checks each step.

- Step 1 · 7 lessons · 5 h

### Python from zero

For a complete beginner. No code needed before it.

- 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.
- 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.
- 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.
- 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.
Every lesson in the course
- Step 2 · 7 lessons · 6 h

### Python with real habits

After Python from zero: the habits real projects need.

- Classes Classes and objects on a BME280: the driver class you already use, a Reading class of your own with methods and __str__, an object that remembers the highest temperature, and inheritance.
- Exceptions Read a traceback, catch the I2C error a missing chip really raises, scan two addresses without crashing, raise an exception of your own, and clean up with else and finally.
- Tests with assert No pip and no pytest, so tests are plain assert: catch a real off-by-one in a voltage conversion, test the edges, write a ten-line test runner, and let a failing test drive a fix.
Every lesson in the course

Keep going

## Guides and tools on the same subject

Guide

### Raspberry Pi GPIO with Python

Open it

Simulator

### MicroPython simulator

Open it

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 the whole track

Questions

## Questions people ask

Is Python good for a complete beginner?

Yes. It has very little punctuation to learn, and Python from zero assumes no experience at all.

Do I need a Raspberry Pi?

No. The lessons run on a simulated Raspberry Pi in your browser. On a real Pi, the same Python and gpiozero code runs as written.

Is this the same Python used for jobs?

Yes. It is standard Python 3. The second course covers modules, classes, exceptions and tests, which is how Python is written at work.
