Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction to nested lists
3. Accessing single elements
Iterating over nested lists
Modifying nested lists
Working with multiple lists
Summary

Instruction

Great! Now, how can we access specific elements in a nested list? We need to use square brackets twice, as shown below:

donations = [
  [345.0, 287.80, 119.27, 329.30],
  [294.25, 349.0, 178.90, 232.34],
  [401.0, 455.45, 289.43, 319.27]
]

Access the first element of the first list (i.e., 345.0):

donations[0][0]

Access the second element of the third list (i.e., 455.45):

donations[2][1]

nested-lists

First, we need to specify the index of the list (the "row"). Then we add the index of the element (the "column"). As usual, indexes start at 0, not 1.

Exercise

Print the name of the team that won the 1st prize for the third application.

The 1st prize winner is the first element in each nested list.

Stuck? Here's a hint!

Use hackathon_results[2][0].