6. What are the names of the winners?¶
6.1. Using another list¶
We can use two lists to find out.
The
names
andscores
lists to save the names and scores obtained by the participants respectively.
6.2. But these data are incorrect!¶
There must be a problem because Zack is really bad!
What happened?
By sorting the
names
list in decreasing order, the character'Z'
ends up being the first.The correspondence between scores and the names of the participants is lost.
Another data structure is needed to avoid losing the correspondence.
6.3. We need to join the lists¶
6.4. Using and sorting a dictionary¶
Using a dictionary and seeing all its elements iteratively.
Using a dictionary for the championship.
You have attempted of activities on this page