Parallel Lists¶
Create three lists to store data about five people. The first list should be strings and should hold their last names. The next list should be float
s and should hold a grade average (on a 100
-point scale). The last list should be a list of int
s, should hold their student id numbers.
Give each of the lists values (using list initializers). Then print the values of all three lists on the screen.
Finally, ask the user for an ID number to lookup. Search through the ID list until you find that ID, and then print out the values from the same slot number of the other two lists.
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 assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Adapted for Python from Graham Mitchell’s Programming By Doing