๐Ÿ PyQuest๐Ÿงบ Lists & Collections ยท ๐Ÿ”ข Pick a Spot
โญ 0 XP๐Ÿ Python is waking upโ€ฆ

Pick a Spot ๐Ÿ”ข

Want just one thing out of a list? Use its position in square brackets.

Here's the weird-but-true part: positions start at 0, not 1!

pets = ["cat", "dog", "fox"]
print(pets[0])    # โžœ cat    (the FIRST one)
print(pets[1])    # โžœ dog
print(pets[2])    # โžœ fox

So a list of 3 things has positions 0, 1, and 2. Programmers count from zero!

To find out how many things are in a list, use len():

print(len(pets))  # โžœ 3

Bonus trick: pets[-1] means "the last one", no counting required. ๐Ÿ˜Ž

Your mission

  1. Make a list called top5 with exactly 5 favorite things (songs, movies, anything)
  2. Print the first one using [0]
  3. Print the last one using [4] (or [-1])
  4. Print how many things are in the list using len()

Your code

Press โ–ถ Run to see what your code does!