Overview
Keep many values in order with a list, read items by position and count them with len().
- [a, b, c] creates a list
- Positions start at 0; -1 is the last item
- len() counts the items
Short Course
A list keeps values in order. Positions start at 0, and -1 means
the last item.
songs = ["Intro", "Song", "Outro"]
print(songs[0]) # Intro
print(songs[-1]) # Outro
print(len(songs)) # 3
songs.append("Bonus")
Task
Write summary(songs) that returns the first song, the last song and the
number of songs, e.g. summary(["Intro", "Song", "Outro"]) →
('Intro', 'Outro', 3).
Test Suites
Pending
Stdout