All courses Python and data

Python for AI from Zero: First Program to First LLM Call

Beginner

No experience needed: build a flashcard quiz on your notes that explains what you missed.

Beginner 18 lessons 56 lab exercises Certificate Updated

You build

A command-line study assistant that quizzes you on flashcards from your own notes files, keeps your best scores in a file, and asks a language model to explain the cards you missed.

You need

Nothing. This course starts from zero.

To build it on your own machine

This is optional and comes with a plan. The course pack brings the starting files, a ready container and a check for every lesson. You need only Docker and git, plus your own AI coding agent if you want a tutor.

What you learn

Start with one line of code and end with a program that asks a language model

You have never written code and you want to build with AI. You write one program from the first lesson to the last: a study assistant for the terminal. It starts as one line that prints a greeting. Then it quizzes you on flashcards from your own notes files, reviews the cards you missed, keeps your best scores, and at the end asks a language model to explain what you got wrong. Each lesson adds one small part that runs, and you finish ready for the courses that start from Python basics.

  • Python from the First Line. What a program is and how to run one, then values, variables, text, decisions and loops. Each idea arrives when the program needs it.
  • Data a Program Can Keep. Lists and dictionaries hold the data while the program runs, text files and JSON keep it between runs, and errors are read and handled so a small mistake ends in a clear message.
  • Code in Good Shape. Functions give each job a name, modules give each group of functions its own file, an installed package adds what Python does not ship, a first test proves a function does what it should, and a class of your own joins data with the code that works on it.
  • A First Call to a Language Model. Settings and a secret key kept outside the code, one request to a web API written by hand to see what travels over the wire, then the same request through the client package that most AI code in Python uses.

Lessons

01

Write and Run Your First Program

Programs and Python, The terminal, Running a Python file, print and text

3 exercises Free
02

Values and Variables

Values and types, Variables, Arithmetic, f-strings

3 exercises
03

Read an Answer and Compare It

Reading input, String methods, Comparisons and booleans

3 exercises
04

Make Decisions with if, elif and else

if and else, Indented blocks, elif chains, Combining conditions

3 exercises
05

Try Again with a while Loop

while loops, Counters, break, Loops that never end

3 exercises
06

Many Cards: Lists and for Loops

Lists, Indexes, for loops, Splitting text

3 exercises
07

Collect the Cards You Missed

Lists that grow, Collecting in a loop, len and empty lists

3 exercises
08

Give Each Job a Name with Functions

Defining and calling, Parameters and arguments, Return values, Local variables

4 exercises
09

Dictionaries: Records with Named Parts

Dictionaries, Reading and changing entries, Lists of dictionaries

3 exercises
10

Read Cards from a Notes File

Modules and import, Paths, Reading a text file, Lines of text

3 exercises
11

Choose a Subject and Handle Errors

Command-line arguments, Reading a traceback, Exceptions, try and except

3 exercises
12

Keep Your Best Scores in a JSON File

Writing a text file, JSON, Saving and loading data, The first run

3 exercises
13

Split the Program into Modules

Your own modules, What import runs, One job per module, Type hints

3 exercises
14

Install pytest and Write a First Test

Third-party packages, Project dependencies, Test functions, Reading a failed test

3 exercises
15

A Class of Your Own: the Flashcard

Classes and objects, __init__ and attributes, Methods and self, Every value is an object

4 exercises
16

Settings and Secrets in a .env File

Environment variables, .env files, Secrets stay out of the code, A config module

3 exercises
17

Call a Web API by Hand

Web APIs, HTTP requests and responses, JSON in and out, API keys

3 exercises
18

Explain Missed Cards with a Language Model

The OpenAI-compatible client, Messages and roles, Prompts built from data, When the call fails

3 exercises

Where it fits

Course 1 of 8 on the AI Engineer path.

How our courses are made Report a mistake