18
Lesson 18 of 20 ยท Data & Lists
Data & Lists โ Part 7
Lists, loops, and algorithms. This is part 7 of 20.
What you'll learn
You will learn that lists store multiple values, and you access them by their index (starting at 0).
Steps
- 1A list holds multiple values in order. Here, items contains three fruits: apple, banana, orange.
- 2items[0] means 'the first item'. In coding, we count from 0! So items[0] is 'apple', items[1] is 'banana', items[2] is 'orange'.
- 3Lists are super useful โ think of a playlist (list of songs), a shopping list, or a leaderboard (list of scores).
- 4You can add items, remove items, and check how many items are in a list with len(). Lists grow and shrink as needed!
Key Terms
- List
- A collection of values in order. In Python: [a, b, c].
- Index
- The position of an item in a list. The first item is index 0.
- len()
- Returns how many items are in a list.
Python 3
Output
Loading Python... This may take a few seconds.
Your code runs only in your browser. No code is sent to any server. Stay safe and have fun learning!
๐จ๏ธView in Shop
Checkout complete lesson on Data & Lists for 8th Grade
Get the full Data & Lists track as a printable PDF โ all lessons, worksheets, and answer keys.
