Phase A
Intermediate Python
Organize code into reusable pieces. Classes, files, clean style.
What you'll be able to do
- ✓Work as a Programmer
- ✓Work as a Software engineer
About this course
Move past beginner Python into the toolkit professional developers actually reach for: classes and dataclasses, modules and packages, file I/O across text/CSV/JSON, iterators and generators, type hints, and the readability habits that make code easy to revisit six months later.
Recommended before this course
Recommendations, not requirements. You can enroll in this course any time.
Curriculum
More CollectionsSets handle uniqueness and fast membership. Tuples are fixed-shape immutable records. Together they finish the picture lists and dicts started. Capstone: a tag index keyed by set dedupe and returned as sorted tuples.
6 lessons
Sets handle uniqueness and fast membership. Tuples are fixed-shape immutable records. Together they finish the picture lists and dicts started. Capstone: a tag index keyed by set dedupe and returned as sorted tuples.
- What Is a Set?Theory
- Dedupe and MembershipExercise
- Set OperationsTheory
- Shared and MissingExercise
- Tuples and ImmutabilityTheory
- Build: Tag IndexExercise
Pythonic One-linersComprehensions turn three-line build-a-list loops into one expression. Lambdas give you a throwaway function for sort keys. List comps, dict comps, set comps, and lambdas, with the judgement to know when a plain loop is still the right call. Capstone: a leaderboard ranker.
6 lessons
Comprehensions turn three-line build-a-list loops into one expression. Lambdas give you a throwaway function for sort keys. List comps, dict comps, set comps, and lambdas, with the judgement to know when a plain loop is still the right call. Capstone: a leaderboard ranker.
- List ComprehensionsTheory
- Squares and EvensExercise
- Dict and Set ComprehensionsTheory
- Price Lookup and Unique InitialsExercise
- Lambdas, map, filterTheory
- Build: LeaderboardExercise
Classes and ObjectsObject-oriented Python from the ground up. Class vs dict, methods and invariants, properties and dunders, inheritance and polymorphism, composition and encapsulation, then classmethods, staticmethods, and dataclasses. Capstone: a small game character system.
17 lessons
Object-oriented Python from the ground up. Class vs dict, methods and invariants, properties and dunders, inheritance and polymorphism, composition and encapsulation, then classmethods, staticmethods, and dataclasses. Capstone: a small game character system.
- From Dict to ClassTheory
- A Point ClassExercise
- Methods and AttributesTheory
- Bank AccountExercise
- Class State and InvariantsTheory
- Rectangle and CircleExercise
- Class DrillsExercise
- Library CatalogueExercise
- Class vs Instance AttributesTheory
- Fix the Mutable DefaultExercise
- Properties and Dunder MethodsTheory
- Money with DundersExercise
- Inheritance, super(), and PolymorphismTheory
- Composition and EncapsulationTheory
- Classmethods, Staticmethods, and DataclassesTheory
- Shape Hierarchy DrillsExercise
- Build: Game Character System (Capstone)Exercise
Modules and PackagesOne file was fine for a hundred lines of code. At a thousand, you split them. This module teaches imports, the standard library tour you will use for the rest of the course, and how packages get installed in the browser editor. Capstone: a small word-stats tool that uses Counter and statistics together.
6 lessons
One file was fine for a hundred lines of code. At a thousand, you split them. This module teaches imports, the standard library tour you will use for the rest of the course, and how packages get installed in the browser editor. Capstone: a small word-stats tool that uses Counter and statistics together.
- import and Your Own ModuleTheory
- Use What You ImportedExercise
- A Tour of the Standard LibraryTheory
- Counter and MeanExercise
- Packages, pip, and micropipTheory
- Build: Word Stats (Capstone)Exercise
Reading and Writing FilesOpen a file with the with statement, read it, write it, append to it, parse CSV with DictReader, and store structured data with json. Capstone: a JSON journal that stamps each entry with the current time.
7 lessons
Open a file with the with statement, read it, write it, append to it, parse CSV with DictReader, and store structured data with json. Capstone: a JSON journal that stamps each entry with the current time.
- Opening Files the Safe WayTheory
- Read a PoemExercise
- Writing and AppendingTheory
- Save a RosterExercise
- CSV FilesTheory
- Grades from CSVExercise
- Build: JSON Journal (Capstone)Exercise
Lazy SequencesIteration up close. The iterator protocol, generator functions with yield, generator expressions, custom iterator classes, yield from delegation, and coroutines driven by .send. Capstone: a streaming log scanner that combines a custom iterator class with a coroutine aggregator.
11 lessons
Iteration up close. The iterator protocol, generator functions with yield, generator expressions, custom iterator classes, yield from delegation, and coroutines driven by .send. Capstone: a streaming log scanner that combines a custom iterator class with a coroutine aggregator.
- What Is an Iterator?Theory
- Count Lines LazilyExercise
- Generators with yieldTheory
- Fibonacci and ChunksExercise
- Generator ExpressionsTheory
- The Iterator Protocol Up CloseTheory
- Build Your Own RangeExercise
- yield from and DelegationTheory
- Coroutines: .send and PrimingTheory
- Streaming Pipeline DrillsExercise
- Build: Log ScannerExercise
Type Hints and Readable CodeType hints document what your functions take and return. Light refactoring turns a long function into clean small ones. Capstone: refactor a messy journal into a clean, hinted, multi-function module.
6 lessons
Type hints document what your functions take and return. Light refactoring turns a long function into clean small ones. Capstone: refactor a messy journal into a clean, hinted, multi-function module.
- Why Type HintsTheory
- Annotate the CalculatorExercise
- Collection Hints and OptionalTheory
- Hint the InventoryExercise
- Naming and RefactoringTheory
- Build: Refactor the JournalExercise