Converting Parallel Lists¶
Let’s take the concept introduced in the exercise parallel lists and create a better structure.
Create five dictionaries to store information about five students. Each dictionary will have the following information:
last_name: str
grade_average: float
student_id: int
Store all five student dictionaries into a single list, then print out the information for all five students.
Finally, ask the user for a student_id
and search the list of dictionaries for the student with that id and print out their information.
Values:
Mitchell 99.5 123456
Ortiz 78.5 813225
Luu 95.6 823669
Zimmerman 96.8 307760
Brooks 82.7 827131
ID number to find: 307760
Found at index 3
Name: Zimmerman
Average: 96.8
ID: 307760
©2021 Daniel Gallo
This work is licensed under Attribution-NonCommercial-ShareAlike 4.0 International