Can write small programs
Python Intermediate
- 30 lessons
- About 60 minutes per lesson
Move from small programs to real data. Learn file I/O, validation, structured processing and automated tests, then deliver a repeatable data workflow.
View the syllabus
What you’ll be able to do
- Read and write CSV and JSON and report invalid records.
- Filter, group and sort records and explain where each total comes from.
- Separate responsibilities, write tests and generate reproducible reports from the command line.
Course syllabus
Open a module for the lesson breakdown, a worked example and an assignment.
Lessons 1–5 Filtering, transforming and sorting
Make records from different sources consistent and comparable.
- Filter and transform records with comprehensions.
- Represent fields in dictionaries and handle missing values.
- Trim whitespace and normalise letter case.
- Use a set to detect duplicates and define which record survives.
- Use a multi-field sort key to settle ties.
Lessons 6–10 Files, CSV and JSON
Read and write structured files and check that fields survive each step.
- Read and write UTF-8 text using with.
- Read named columns with csv.DictReader.
- Convert numeric fields and verify parsing of commas and quotes.
- Save and restore nested data with json.dump and json.load.
- Convert a file and check an empty table and non-ASCII characters.
Lessons 11–15 Validation and exceptions
Locate errors at file or row level and report how to correct them.
- Distinguish missing fields, wrong types and out-of-range values.
- Use try/except to handle expected numeric conversion failures.
- Record an invalid row’s line number and reason, then continue.
- Distinguish a bad row from a failure to read the file.
- Check that multiple errors do not cause valid rows to be lost.
Lessons 16–20 Grouping, aggregation and reports
Summarise records by person or date and define duplicate and ranking rules.
- Use a dictionary to tally counts and minutes by name.
- Use a composite key for person and date.
- Define how duplicate records are detected and which copy is kept.
- Compute averages and handle groups with no data.
- Produce a stable report and reconcile totals across groups.
Lessons 21–25 Modules, command line and automated tests
Make processing reusable and testable, with a command-line entry point.
- Separate file reading, aggregation and report writing.
- Reuse functions with import and put the command entry point in main.
- Accept input and output paths with argparse.
- Use unittest to verify pure functions and boundaries.
- Test one complete read-and-write run in a temporary directory.
Lessons 26–30 Project: attendance report
Combine ingestion, validation, aggregation and output into a repeatable tool.
- Specify input fields, valid ranges and both output files.
- Implement ingestion and separate valid data from invalid rows.
- Aggregate visits and minutes per person and specify ordering.
- Generate reports and verify that rerunning does not accumulate old results.
- Deliver usage instructions, sample files and the test command.
A sample exercise
Sort Bo 8, Mia 10 and Ana 8 by descending score, then ascending name.
See the worked example →Common questions
What is the first lesson?
Filter and transform records with comprehensions. · Filtering, transforming and sorting
How can I check my progress?
Submit an attendance reporting program that reads raw CSV, writes per-person summaries and lists invalid rows. Include tests and show that rerunning gives the same result.