Course 1 of 7 · Beginner

Pythonfrom your first line to real ML code.

Every lesson shows what the interpreter actually does, line by line, so you can predict what code will do before you run it.

7modules
33lessons planned
33ready to study now
10free videos

Who Python is for and what you will learn

This track is for you if

  • You have never programmed, or you have copied Python without being sure what it does.
  • You want the Python that data and machine learning code actually uses.
  • You use an AI assistant to write code and want to check what it wrote.

By the end you can

  • Predict what a piece of Python code does before running it.
  • Read an error message and find the line that caused it.
  • Write functions, classes and tests for real data tasks.
  • Read and check code an AI assistant wrote for you.

Before you start

None. This is the starting point if you have never programmed. Everything runs in Google Colab, in the browser.

Every open lesson is free to read. Stage 0, modules 1 to 5, is a free sample: a free account opens all of its material. Pro adds it for the rest of the course.

The syllabus7 modules, each ending in its own finish line.

Every lesson is listed, including the ones still in production, so you can see where the track goes. Open lessons have their parts and key terms free to read, and their quiz free with an account.

  1. Module 1 · 6 lessons · free videos

    Getting Started

    Builds to: Bill Splitter
    1. 1.1Why Python?Say what Python is and why it is used for AI and machine learning, and know where Python code is written and run.Written walkthrough
    2. 1.2Run Your First Python CodeRun Python in a notebook and know what happens when a cell executes.Written walkthrough
    3. 1.3Variables, Keywords and IdentifiersBind names to objects, and name variables by Python's rules.Written walkthrough
    4. 1.4Data TypesKnow the basic types and how they convert.Written walkthrough
    5. 1.5Input, Output and FormattingRead input and print results readably.Written walkthrough
    6. 1.6OperatorsCompute and compare with Python's operators, and know their precedence.Written walkthrough
  2. Module 2 · 4 lessons · free videos

    Control Flow

    Builds to: Loan Repayment Schedule
    1. 2.1if, elif and elseMake the program choose.Written walkthrough
    2. 2.2while LoopsRepeat until a condition changes, and avoid infinite loops.Written walkthrough
    3. 2.3for Loops and rangeIterate over any sequence.Written walkthrough
    4. 2.4break, continue and else on LoopsControl a loop from the inside.Written walkthrough
  3. Module 3 · 6 lessons · videos in production

    Data Structures

    Builds to: The Most Common Words in Product Reviews
    1. 3.1ListsStore ordered, changeable collections and slice them.Written walkthrough
    2. 3.2TuplesUse fixed-size immutable records, and unpack them.Written walkthrough
    3. 3.3SetsKeep unique items and ask membership questions fast.Written walkthrough
    4. 3.4DictionariesMap keys to values: counting, grouping, lookup.Written walkthrough
    5. 3.5StringsClean and split text, the first step of every text model.Written walkthrough
    6. 3.6ComprehensionsBuild lists, sets and dicts in one readable line.Written walkthrough
  4. Module 4 · 4 lessons · videos in production

    Functions

    Builds to: The Word Counter, as Functions
    1. 4.1Defining FunctionsPackage code into reusable functions with inputs and outputs.Written walkthrough
    2. 4.2Arguments and ScopePass arguments every way Python allows, and know where names live.Written walkthrough
    3. 4.3RecursionSolve a problem by calling the same function on a smaller version of it.Written walkthrough
    4. 4.4Lambdas and Functions as ValuesPass functions around, the pattern behind `sorted(key=...)` and `apply`.Written walkthrough
  5. Module 5 · 7 lessons · videos in production

    Organising Code

    Builds to: review-stats, Finished
    1. 5.1Modules and PackagesSplit code across files and import it; use other people's packages.Written walkthrough
    2. 5.2uv, Packages and EnvironmentsInstall Python and packages for a project without breaking other projects.Written walkthrough
    3. 5.3Working with FilesRead and write text, CSV and JSON files.Written walkthrough
    4. 5.4ExceptionsHandle errors deliberately instead of crashing.Written walkthrough
    5. 5.5DebuggingFind a bug systematically.Written walkthrough
    6. 5.6Testing with assert and pytestCheck that code does what it should, automatically and every time it changes.Written walkthrough
    7. 5.7Formatting, Linting and Type CheckingLet tools find the mistakes a reader would otherwise have to find.Written walkthrough
  6. Module 6 · 3 lessons · videos in production

    Objects and Classes

    Builds to: tiny-models
    1. 6.1Classes and ObjectsBundle data and behaviour into objects, and read code that does.Written walkthrough
    2. 6.2DataclassesDefine a class that mainly holds data in a few lines, with type hints.Written walkthrough
    3. 6.3The Estimator PatternWrite a tiny model class with `fit` and `predict`, the shape every scikit-learn model has.Written walkthrough
  7. Module 7 · 3 lessons · videos in production

    Time and Space Complexity

    Builds to: log-tools
    1. 7.1Time and Space ComplexityEstimate how running time grows with input size.Written walkthrough
    2. 7.2Binary SearchFind an item in a sorted list in log time.Written walkthrough
    3. 7.3Hash TablesSee why a dict lookup is fast, and use that to speed up an algorithm.Written walkthrough

How Python is taughtone lesson, opened up.

Lessons in this track are built the same way. Here is Python 6.3 as its outline lists it: what it builds on, its parts in order, and everything around it in its module.

Python 6.3 · 11 min

The Estimator Pattern

Write a tiny model class with `fit` and `predict`, the shape every scikit-learn model has.

The lesson, part by part
  1. The estimator interface: fit and predict
  2. fit and learned state: a mean predictor
  3. Learned attributes and the trailing underscore convention
  4. Hyperparameters: k nearest neighbours
  5. Changing the hyperparameter k
  6. Comparing with scikit-learn's KNeighborsRegressor
  7. Common estimator errors: aliased input data and refitting
  8. Recap and challenge: the estimator pattern

Key term · fitThe method that learns from examples. It stores what it learned in attributes ending in _, and returns self.

After the lesson
  • A 5-question quiz, marked the moment you answer
  • Practice at levels A to C, with values to check against
  • Where the idea is used in real work
  • Common mistakes: the error you will see, why, and the fix
In its module · 6. Objects and Classes
  • 2 notebooks to run the examples yourself
  • 25 interview questions with model answers

What's inside a lessonin Python, published so far.

Counted from this track's published lessons. A part still being written is left out until it is published.

  1. Learn

    The lesson

    Short parts, each with its key terms, and a free video where one is recorded.

    33 lessonsNo account
  2. Check yourself

    Quiz

    Multiple-choice questions on the lesson, marked the moment you answer.

    33 lessonsFree account
  3. Practise

    Assignments

    Exercises to do yourself, starting from the lesson's own challenge.

    33 lessonsPro
  4. Apply it

    Real-world applications

    Where each idea is used in real work, from data analysis to production models.

    33 lessonsPro
  5. Avoid

    Common mistakes, and the fix

    The error you will actually see, why it happens, and how to fix it.

    33 lessonsPro
  6. Prepare

    Interview questions

    Questions an interviewer asks about each module, with model answers.

    175 questionsPro
  7. Build

    Projects and notebooks

    Module projects, set as a problem with no template and checked by a notebook, and notebooks to run the examples yourself.

    7 projects, 21 notebooksPro

What you will build7 module projects, each set with no template.

Each project is a problem to solve on your own, then checked against test values or a notebook.

Start free, go further with Pro

Compare the plans

Free

In Python:

  • All 33 lessons' parts and key terms, no account
  • 10 free video lessons
  • Quizzes and saved progress with a free account
  • Every layer of modules 1 to 5, the free sample
Start with 1.1 Why Python?
Pro

Pricing announced soon.

  • Every course, from Python to deep learning and generative AI
  • Practice problems for every lesson, levels A to C, with values to check
  • Self-checking notebooks that mark your answers as you go
  • Module projects, cheat sheets, common mistakes and interview answers
  • A certificate for every course you complete
  • Weekly live sessions with Gaurav
  • Everything in Free

Worked articles on Python

All Python resources

Where Python is used

All AI applications

Questions about Python

Do I need to install anything?

No. Every lesson runs in Google Colab in the browser. Installing Python locally is taught later in the track, when a project needs it.

Which version of Python does the course use?

Python 3.12, the version Google Colab runs. Every output shown in a lesson was recorded on it.

I already know some Python. Where should I start?

Skip ahead if you can already write a function that loops over a list. The Data Tools track is the next step.