Anatomy of Lists
Lists group items together. Click the parts below to see what they do. Lists are fundamental Data Structures.
print(tech_items[1]) # Accessing the second item
Identify all parts!
Build-a-List
Drag the pieces to create a list named `scores` containing the numbers 10, 20, and 30. This uses Abstraction - hiding the complexity of storage.
List Access Simulator
Given the list below, type a command to access one of its elements by index (e.g., `planets[0]`). Remember, indexing starts at 0!
planets
= ["Mercury"
, "Venus"
, "Earth"
, "Mars"
]Spot the Valid Index
Given the list data
below, click on the lines that will access an element *without* causing an `IndexError`.
Check your selections using the button.
data
= [100
, 200
, 300
]List Mini Missions!
Time to code with lists! Complete these tasks. Use the simulator's output and feedback.
Mission 1: Create a Fruit List
Create a variable named `fruits` assigned to a list containing three strings: "apple", "banana", "cherry".
Mission 2: Access the Second Element
First, create a list named `temps` with numbers: `[25.5, 26.0, 24.8]`. Then, on the next line, use `print()` to display the second temperature (index 1).
Mission 3: Find List Length
Create a list named `colors` containing any 4 color strings (e.g., "red", "blue", ...). Then, use `print()` and the `len()` function to display how many colors are in the list.
Module 10 Practice Complete!
Great job working with lists! You've learned to create, access, and find the length of these versatile data structures.
Ready for more list manipulation? Try the Advanced Practice for Module 10!