Pebellslearn by building
RoadmapsMatrixCoursesSandboxSign in

Course details

Python

Core Python end to end — syntax, collections, functions, robustness and objects — then the advanced arc: the object model, generators, decorators, files and encodings, CSV/JSON/SQLite, regular expressions, packaging, logging and testing, built into one real data tool, Quarry. Every AI, data and engineering path starts here.

Ready to learn17 sections · 91 lessons
Start learning

Course curriculum

Fundamentals14 lessons

Syntax, variables, types, operators, control flow, functions, and errors. You won't just read about them — each lesson you'll write one working piece of a real Bill Splitter & Tip Calculator, and in the capstone you'll wire them into a live restaurant app.

  1. Basic Syntax & Output10 min
  2. Variables & Data Types12 min
  3. Operators & Math12 min
  4. Working with Strings16 min
  5. Conditionals16 min
  6. Loops13 min
  7. Type Casting & Input13 min
  8. Functions15 min
  9. Exceptions & Errors13 min
  10. Built-in Functions13 min
  11. Lists, Tuples & Sets16 min
  12. Dictionaries16 min
  13. Type Annotations12 min
  14. Capstone — Bill Splitter & Tip Calculator30 min
Fundamentals Follow-up Projects4 lessons

Four guided builds that use conditionals, loops, functions, exceptions and collections together: a café till, a messy-file CSV analyzer, a budget tracker with alerts, and a text adventure. Each ends in a tested program you finish yourself — the real test before Data Structures & Algorithms.

  1. Project 1 — Terminal Café POS40 min
  2. Project 2 — CSV Data Analyzer40 min
  3. Project 3 — Expense & Budget Tracker40 min
  4. Project 4 — Text Adventure40 min
Objects7 lessons

Everything so far has been data on one side and functions on the other. Objects put them together — and once state and behaviour live in the same place, you can make guarantees about it. You'll build a small bank, and the four pillars turn up as the things you needed anyway: an account that cannot go negative (encapsulation), a savings account that specialises it (inheritance), a billing run with no if/elif chain (polymorphism), a product contract nothing incomplete can slip past (abstraction) — and types that behave like Python's own.

  1. What Is OOP?14 min
  2. Classes & Instances15 min
  3. Encapsulation16 min
  4. Inheritance16 min
  5. Polymorphism15 min
  6. Abstraction16 min
  7. Dunder Methods15 min
The Object Model4 lessons

Quarry loads batches of rows and hands them from stage to stage, and three kinds of bug keep surfacing that no single line seems to cause: a stage that edits rows another stage was still reading, a lookup that can no longer find a key it stored, and a long run whose memory only ever climbs. All three come from the same place — how Python binds names to objects. This section builds Quarry's inspector, the tool that reports what a loaded batch secretly shares, what can't safely be used as a key, and what refuses to die. You start with identity and binding, then mutability and hashing, then what keeps an object alive and how the collector frees what reference counting can't. The capstone points the inspector at a real batch.

  1. Names, Objects & Identity20 min
  2. Mutable, Immutable & Hashable22 min
  3. What Keeps an Object Alive24 min
  4. Capstone — The Inspector40 min
Iteration & Laziness4 lessons

Quarry's sources are bigger than the memory it runs in: a 200 MB server log, an export with a million rows. Reading those into a list first is how a tool runs out of memory at three in the morning. This section teaches Python's answer, which is to hand data over one piece at a time and only when someone asks. You start by writing the iterator protocol by hand, the two methods and one exception behind every for loop. Then generators, functions that pause at each value and keep their local variables while they wait. Then pipelines, generators chained so that one record passes through every stage before the next is read. The capstone joins them into Quarry's feed, which streams a whole file in constant memory and stops reading the moment it has enough.

  1. Writing an Iterable by Hand22 min
  2. Generators: Functions That Pause22 min
  3. Chaining Generators into a Pipeline24 min
  4. Capstone — The Feed40 min
Closures & Decorators6 lessons

Quarry runs unattended, so every stage needs the same four things around it: a log line, a retry when a source hiccups, a timing, and a cache so the same lookup is never paid for twice. Writing those by hand into every stage is how a codebase rots. This section builds them once, as wrappers. You start with closures — functions that keep a variable alive after the function that made it has returned — because every decorator is a closure. Then you write decorators, decorators that take settings, the standard library's own toolkit in functools, and the calling rules that let one wrapper fit any function. The capstone snaps them together into Quarry's middleware ring.

  1. Closures & the Cell22 min
  2. Decorators24 min
  3. Decorators That Take Arguments24 min
  4. functools24 min
  5. Callables, *args & Signatures22 min
  6. Capstone — The Middleware Ring40 min
The Standard Toolbox5 lessons

Five lessons on the modules that replace hand-rolled code: counting and grouping with collections, priority order with deque and heapq, named constants with enum, numbers and randomness with math and random, and the lazy combinators in itertools. None of this is new syntax — it's the standard library doing, in one import, what the last few sections taught you to write by hand.

  1. Collections: Counter, defaultdict, namedtuple, OrderedDict16 min
  2. deque and heapq16 min
  3. Enum14 min
  4. math and random15 min
  5. itertools16 min
Data Structures, Lightly6 lessons

A light, Python-first pass over the classic structures every roadmap expects: arrays and linked lists, hash maps, stacks/queues/heaps, binary search trees, recursion, and sorting. Each lesson shows the structure in real Python code and the mistake people actually make with it. This section stays short on purpose — the Big-O proofs, balancing, and deeper structures live in the dedicated DSA course; here the goal is just to recognise the shape and use it correctly.

  1. Arrays & Linked Lists14 min
  2. HashMaps13 min
  3. Stacks, Queues & Heaps14 min
  4. Binary Search Trees15 min
  5. Recursion13 min
  6. Sorting Algorithms14 min
Functional Python5 lessons

Every function so far has lived in one scope and run its logic with plain statements. This section closes two gaps at once: exactly how Python decides which variable a name refers to (the LEGB rule, and the bugs that come from getting it backwards), and the idioms — lambdas, map/filter/reduce, comprehensions, generator expressions — for writing a transformation as a single expression instead of a loop. It ends by naming the three styles (imperative, object-oriented, functional) every later lesson in this course will keep switching between.

  1. Variable Scope & the LEGB Rule18 min
  2. Lambdas, map, filter & reduce18 min
  3. List & Set Comprehensions16 min
  4. Generator Expressions16 min
  5. Programming Paradigms16 min
Files, Paths & Encodings6 lessons

Every program eventually meets a folder full of files somebody else made. This section is about meeting it well: finding things with pathlib instead of string surgery, opening them in the right mode, writing context managers so cleanup can't be skipped, decoding text that lies about its encoding, and reading binary formats byte by byte with struct. You'll build Quarry's yard — the part that walks a directory and hands the rest of the program text it can trust.

  1. pathlib20 min
  2. Reading & Writing, Text and Binary22 min
  3. Writing Your Own Context Manager24 min
  4. Unicode, str and bytes24 min
  5. Bytes, Buffers & struct24 min
  6. Capstone — The Yard40 min
Serialisation & Storage5 lessons

Everything Quarry knows lives in memory, and memory ends when the program does. This section is about the trip out and the trip back: CSV for the spreadsheets people hand you, JSON for the documents machines trade, pickle for Python talking to itself (and why it must never listen to strangers), and SQLite for data you want to query instead of reread. You'll build Quarry's vault one piece at a time, and the capstone proves the whole trip loses nothing.

  1. CSV & the Dialects Nobody Agrees On22 min
  2. JSON, and the Types It Cannot Hold22 min
  3. Pickle, and Why You Must Not Load Untrusted Data22 min
  4. sqlite3 & the DB-API26 min
  5. Capstone — The Vault40 min
Text & Patterns5 lessons

Log lines look structured until you try to read forty thousand of them. This section builds Quarry's extractor: a gate that recognises a real log line, named groups that pull out its fields, substitutions that mask what must not leave the building, a guard against patterns that take exponential time, and finally a parser that turns lines from two different services into one typed record. Along the way you learn what regex is superb at — flat shapes in text — and exactly where to stop and write a scanner instead.

  1. Regular Expressions24 min
  2. Groups, Named Captures & Lookaround24 min
  3. sub, split, finditer & Flags22 min
  4. Catastrophic Backtracking & When Not to Use Regex24 min
  5. Capstone — The Extractor40 min
Modules, Environments & Packaging3 lessons

Quarry works — as long as you run it from the right folder with the right command on the right machine. This section turns it into something other people install. You'll learn what `import` really does (find, run once, cache, bind), how packages and relative imports resolve, why every project gets its own virtual environment and a lock file of exact versions, and how `pyproject.toml`, a wheel and one entry-point line turn a function into a `quarry` command on anyone's machine.

  1. Modules, Packages & What import Really Does26 min
  2. Virtual Environments & Pinned Dependencies24 min
  3. pyproject.toml, Wheels & the Console Entry Point26 min
Failure & Observability3 lessons

Quarry runs unattended, at night, on files nobody has checked. Sooner or later something goes wrong, and the only question that matters is whether the program tells you what happened — or quietly reports success with zero rows. This section builds Quarry's black box. You'll read the exception tree and give Quarry its own branch of it, chain each error to the one that caused it, make cleanup run on every way out, and replace print with logging that has levels, names and destinations. The capstone wraps a whole run so that a crash leaves behind a report: what failed, where, why, and the last things the program said before it did.

  1. The Hierarchy, `raise from` & `finally`28 min
  2. Logging26 min
  3. Capstone — The Black Box40 min
Testing & Debugging7 lessons

Quarry now parses, stores and reports — and every change you make could quietly break a piece you finished weeks ago. This section builds the test rig that stops that from happening. You'll write the tests pytest would collect, give them fresh fixtures and parametrised cases, replace the network and the clock with doubles you control, let random inputs hunt for the case you never thought of, walk a crashed program's frames after the fact, bisect a bad change down to one step — and finish with a runner that reports on the whole suite.

  1. Your First pytest Suite22 min
  2. Fixtures, Parametrisation & Scope24 min
  3. Doubles, patch & Test Seams26 min
  4. Properties, Coverage & Honest Green24 min
  5. pdb, Post-Mortem & Bisecting24 min
  6. unittest, doctest & tox20 min
  7. Capstone — The Test Rig40 min
Frameworks & Tooling6 lessons

Everything so far has run inside the browser. This section is honest about the parts of real Python work that can't: the tools that install packages, check types before a program runs, serve a web API, juggle many things at once, or reformat a file. Most of it reads real commands and real code as read-only examples — a requirements.txt, a mypy error, a Flask route. Each lesson still finds the slice that genuinely runs in the browser and builds on it: parsing a version pin, checking a value against an annotation, matching a request to a handler.

  1. Package Managers14 min
  2. The Static Typing Ecosystem15 min
  3. Choosing a Web Framework15 min
  4. Threads and the GIL16 min
  5. Multiprocessing and Asyncio16 min
  6. Formatters, Linters and Docs14 min
Capstone — Quarry1 lessons

Every section since the object model built one piece of Quarry: the inspector, the feed, the middleware ring, the yard, the vault, the extractor, the shipment, the black box and the test rig. Each one works on its own. This capstone wires them into one run that walks a directory of logs, reads each file with retries, decodes it whatever its encoding, pulls fields out with a regex, streams the records into SQLite without holding them in memory, logs everything it had to skip or give up on, and reports. You finish the arc with a working program and tests of your own that prove it.

  1. Capstone — Quarry, End to End35 min