Almost every AI library, model SDK and data tool ships for Python first, so it is the language most AI work starts in. This course teaches Python with that destination in mind: instead of generic exercises, you learn the parts of the language and ecosystem that show up in AI projects, from managing dependencies and secrets to validating model output and calling APIs concurrently. By the end you can read the code in most AI tutorials and write your own without copying blindly.

What you'll learn

  • Core Python: data types, functions, control flow, comprehensions and working with files
  • Modern project setup with uv: virtual environments, lockfiles and reproducible installs
  • Type hints and why they matter when model output is unpredictable
  • Pydantic models for validating JSON and structured output from LLMs
  • Working with JSON, CSV and text data, and reading documents from disk
  • HTTP with httpx: requests, retries, timeouts and rate limits
  • async and await for calling several models or APIs at once
  • Using the official LLM SDKs for providers such as OpenAI, Anthropic and Google
  • Keeping API keys out of code with environment variables and .env files
  • Jupyter notebooks for experiments, and when to move code into a proper package with tests

Who it's for

  • Beginners who want to build with AI and need a focused route into Python
  • Developers from JavaScript, PHP or other languages moving into AI work
  • Analysts and no-code builders ready to write their own scripts around model APIs

Prerequisites

  • Basic computer skills and comfort using a terminal (see Linux Command Line for Developers if you are new to it)
  • No prior Python experience needed; some experience in any programming language helps
  • An API key from at least one model provider for the later modules

Outcomes

By the end of this course you will be able to:

  1. Set up a clean, reproducible Python project for AI work.
  2. Call LLM APIs from Python, handle errors and validate what comes back.
  3. Run many requests concurrently without hitting rate limits blindly.
  4. Organise experiments into tested, reusable modules ready for the next course.

Projects you'll build

  • Structured extraction CLI: A command-line tool that reads a folder of text files, asks a model to fill a Pydantic model for each one and writes valid results to CSV, logging anything that fails validation. Practises files, typing, validation and SDK calls.
  • Concurrent model caller: Send a batch of prompts concurrently with asyncio and httpx, using a semaphore, retries with backoff and a log of tokens used. Practises async code, error handling and rate limits.
  • Notebook to tested package: Compare two model providers on a small test set in Jupyter, then move the working code into a package with pytest tests. Practises experimentation habits, project structure and testing.

Tools you'll use

  • A current Python 3 release (3.12 or newer)
  • uv for environments, dependencies and lockfiles
  • VS Code with the Python extension
  • Pydantic
  • httpx and tenacity for retries
  • The official OpenAI, Anthropic and Google Gen AI Python SDKs
  • python-dotenv
  • Jupyter, pytest and Ruff

Course outline

ModuleTopic
1Installing Python and uv, and your first script
2Data types, control flow and functions
3Lists, dictionaries, comprehensions and files
4Modules, packages and project structure
5Type hints and dataclasses
6Pydantic for validation and structured data
7HTTP APIs with httpx, retries and timeouts
8Calling LLM SDKs and handling secrets
9Async Python for concurrent requests
10Jupyter notebooks and moving code out of them
11Testing with pytest and basic logging
12Project: a small command-line AI tool

FAQ

How is this different from Python for Automation?

Python for Automation focuses on office tasks such as spreadsheets, files and browser jobs. This course focuses on the language features and libraries used when building with AI models.

Do I need maths or machine learning knowledge?

No. This course is about calling and wrapping models, not training them. If you later want to train models, Machine Learning Fundamentals is a good next step.

What should I take after this?

Building AI Apps with LLM APIs builds directly on what you learn here.

What are the common beginner pitfalls?

Committing API keys to Git, installing packages globally until projects conflict, and trusting model output without validating it. The opposite mistake is firing hundreds of requests at once and hitting rate limits, which is why async is taught together with limits and retries.

How do I join?

Get in touch and we'll share the current format, schedule and enrolment details.