Who it is for: Learners who finished Python 2: decisions and loops.
Most useful programs keep lists of records and save them between runs. A program that saves a grade book or a stock list can replace a paper register. At the end, the learner can write functions, test them, store records in lists and dictionaries, and save data to a file that the program reads next time.
Each function gets its tests before the learner moves on. Tests are how a programmer checks code, whether a person or an AI wrote it.
AI policy: Builders may use AI only as a tutor (explain or give a hint, never the answer), with the teacher present, and only after they have shown the skill without it. Pioneers and adults may use AI after the checkpoint, and must test any code and explain it in their own words. The checkpoint and the capstone defence are done without AI.
Planned lessons
- Defining your own function
- Parameters and return values: trace the call by hand
- Testing a function with assert
- Lists: adding, removing, and indexing
- Looping over a list
- Dictionaries for named data
- Reading a text file
- Writing results to a file
- Handling errors with try and except
- Using the standard library: import
- A contacts or grades program that saves its data
Teach it as
| One session | Predict what a short function returns, then write one function that takes a list and returns a total, and test it with assert, in one 2 hour class. |
|---|---|
| One day | Morning: functions, parameters, return values, and testing with assert. Afternoon: lists, looping over a list, and saving a list to a file. |
| One week | Day 1: functions, parameters, and return values. Day 2: testing functions and lists. Day 3: looping over lists and dictionaries. Day 4: reading and writing files, and try and except. Day 5 (Build and Show): checkpoint without AI, then each learner shows and explains a contacts or grades program that saves its data. |
Know this first
- Python 2: decisions and loops
Standards this follows
- CS2023 Software Development Fundamentals (SDF): fundamental programming concepts, fundamental data structures, software development practices
- OpenStax Introduction to Python Programming (CC BY 4.0) as reference
Videos to download
No videos listed yet.