Python for AIPython 3.10+ · Pydantic 2.12
Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
34 small wins to finish your pathNext lesson →

Python for AI logoPython for AI overview

Python is a general-purpose programming language, and the one most AI libraries, model SDKs and agent frameworks are written for.

Last updated: 30 Sep, 2026 · Python 3.14 · Pydantic 2.12

Python was created by Guido van Rossum and first released in 1991. It is free and open source under the PSF License, and the Python Software Foundation looks after it; a new version comes out every October. Its plain syntax made it popular in science and data work, so the libraries for numbers, machine learning and language models grew up around it: NumPy, PyTorch, Hugging Face Transformers, and the SDKs from OpenAI, Anthropic and Google all put Python first.

The parts of Python that AI code uses

AI work uses a small part of the language again and again: text and numbers, lists and dictionaries, functions and classes, files and JSON, error handling, type hints, Pydantic models, and async code for waiting on many model calls at once. This course teaches those parts, in that order, and each lesson uses its idea straight away on the same set of support tickets.

Everything in this course, and where it is going
First lines of PythonMany valuesFunctionsFiles, JSON and errorsClasses and objectsTypes and validationWaiting on modelsA real projectprint and variablestext and numbersif and elselists and for loopsdictionarieslists of dictionariesdef and returnargumentsimportfiles and JSONa stand-in modeltry and exceptclasses and methodsdataclassesinheritancetype hintsPydantic modelschecking a model's answerasync and awaitmany calls at oncetimeouts and retriesvirtual environmentspytestthe triage program
Hover or tap a piece to see what it is and which lesson built it.

The ticket triage program

The course builds one program. It reads five support tickets from a file, asks a model to sort each one into billing, shipping or other with a priority, checks every answer, and saves the results. It starts with a single line in print() and is finished in Project: ticket triage.

What the finished program does
Read the ticketsa list of dictionariesAsk a model about eachall five at onceCheck every answerPydanticSave the resultsa person sorts the restProve it workspytest
Hover or tap a piece to see what it is and which lesson built it.
Trace the program

Pick one to watch it run, step by step.

A model, for this course

A model here means a large language model: a program you send text to and get text back from. The agent frameworks later in the roadmap are mostly ways of sending that text, reading the answer and deciding what to do with it.

Most of the course needs no account and no API key. In Stand-in model you write a small function that answers the way a model does, and the program uses it until the last lesson, where one optional section swaps in a real model on a free Groq key.

Where the videos come in

Many lessons open with a short clip from the channel's Python tutorials, placed above the part of the page it teaches. The clips run in a Jupyter notebook; the code on the page is the same idea written as a plain Python file, and where the two differ, a line under the clip says how.

A browser first, Python on your computer later

No programming experience is assumed. If you already know some Python, the quiz at the end of each part is a quick way to find the lessons worth reading.

Back toAll frameworks

Every expert started right here.