All capabilities · Programming foundations

Write production-quality Python for AI work

Write clean, tested Python with virtualenvs, typing, packaging and async basics — the lingua franca of every AI role.

~30 focused hoursbeginner
Explore 4 tools for this project
What employers mean

You should be able to…

  1. Write clean, typed Python functions instead of untyped notebook cells
  2. Set up a virtualenv/uv project with pinned dependencies (requirements.txt or pyproject.toml)
  3. Write pytest unit tests with fixtures and mocks for functions that call external APIs
  4. Use async/await to call multiple LLM or third-party APIs concurrently
  5. Package a script into an importable module with a proper __init__.py and CLI entrypoint
  6. Handle exceptions and retries around flaky network calls instead of letting scripts crash
  7. Read and refactor someone else's Python codebase without breaking existing tests
Learn — free, link-checked

The few resources that matter

Read · beginner · 20 min · docs.pytest.org

pytest — Get Started

pytest is the de facto testing tool employers expect; this gets you writing and running real tests in minutes. — pytest
Read · beginner · 90 min · docs.python.org

The Python Tutorial

Ground yourself in modern Python syntax and idioms straight from the source before layering AI-specific libraries on top. — Python Software Foundation
Read · beginner · 120 min · fastapi.tiangolo.com

FastAPI — User Guide / Tutorial

The official, example-driven walkthrough from hello-world to a typed, validated, auto-documented API — the framework Indian AI job posts name most. — FastAPI (tiangolo)
Watch · beginner · 360 min · youtube.com

Data Structures and Algorithms in Python - Full Course for Beginners

Builds every core data structure from scratch in Python, cementing both DSA concepts and idiomatic Python at once. — freeCodeCamp.org
Read · intermediate · 25 min · docs.github.com

Building and testing Python

Shows exactly how to wire pytest and matrix Python versions into a CI workflow — the setup interviewers ask you to describe. — GitHub Docs
Read · intermediate · 30 min · docs.python.org

typing — Support for type hints

Type hints are expected in production AI codebases (Pydantic, FastAPI); the canonical reference for annotating functions and generics correctly. — Python Software Foundation
Read · intermediate · 35 min · docs.python.org

asyncio — Asynchronous I/O

LLM API calls are I/O-bound; understanding async/await lets you fan out concurrent model calls instead of blocking one at a time. — Python Software Foundation
Tools for practice

Choose a tool for the job

Start with one tool for each part of your project. You don’t need to learn them all.

Go to the practice brief

4 tools to explore

Practice

Support-ticket triage CLI as a typed, tested Python package

Build a Python package that reads a folder of labelled customer-support tickets, classifies each into a category (refund, fraud, technical) with rules plus one small model call, and writes a summary CSV. Wrap it in a Typer CLI, add asyncio batch processing so a folder of 500 tickets finishes in one pass, and cover the classifier and I/O with pytest fixtures. Type-hint everything and keep mypy at zero errors as the package grows.

Start from

Bitext customer-support dataset on Hugging Face — ~27k tagged support utterances across 27 intents; slice 500 into per-ticket JSON files

Milestones
  1. Slice the dataset into per-ticket JSON and load it into typed records · ~5.5h
  2. Write the rule + model-call classifier behind one interface, with pytest fixtures · ~7.5h
  3. Wrap it in a Typer CLI and add asyncio batching over the 500-ticket folder · ~7.5h
  4. Drive mypy to zero errors and coverage past 80% · ~4.5h
  5. Write the README with sample input/output and the timing numbers · ~3h
Done when
  • Runs via `python -m triage --input tickets/ --output summary.csv` with no crashes on malformed input
  • At least 80% pytest coverage on the classification and I/O modules, run via `pytest --cov`
  • Uses type hints throughout and passes `mypy` with zero errors
  • Processes 500 mock tickets concurrently with asyncio in under 10 seconds on a laptop
Prove it

Evidence a recruiter can check

  • The `pytest --cov` table pasted in the README, showing 80%+ on the classification and I/O modules
  • A clean `mypy` run over the whole package, including the annotations you added for untyped third-party calls
  • Serial vs asyncio wall-clock numbers for the same 500 tickets, measured on your machine and stated in the README
  • The malformed-ticket test you wrote first, and the commit that made the CLI survive it instead of crashing
Signal it

Built a typed, async Python CLI that classifies 500 support tickets in a single pass — 80%+ pytest coverage on the classifier and a zero-error mypy run across the package.

Interview

Questions you'll get asked

  1. What's the difference between a list and a generator, and when would you use each?
  2. Explain GIL — does multithreading help a CPU-bound vs an I/O-bound Python task?
  3. How would you structure a Python project that calls an LLM API with retries and rate limiting?
  4. What does `async def` actually buy you over a regular function when calling 5 APIs?
  5. How do you mock an external API call in a pytest test?
  6. What's the difference between `@staticmethod`, `@classmethod` and a regular method?
  7. Walk me through how you'd add type hints to a function that returns either a dict or None.