Python Functions · Week 5 — Working with Dictionaries
Functions that take a dict (or list of dicts); .items() loops; friendly multi-line output.
Week 5: Functions That Work With Dictionaries
This week, we’ll explore how functions can handle more complex data using dictionaries. Dictionaries let us group related information together, like a student’s profile or a menu item. With .items(), we can loop through all the data inside a dictionary and build readable output. By the end, you’ll be able to write functions that turn raw data into clear, multi-line reports.
Learning goals
- Understand what a dictionary is and how to create one. - Pass a dictionary into a function. - Use .items() to loop through the keys and values in a dictionary. - Build formatted multi-line output from dictionary data. - Process a list of dictionaries to create reports for many items at once.