Note 08: Lists¶
Lists store multiple values in order.
scores = [88, 91, 79]
scores.append(95)
print(scores[0])
Common Patterns¶
- Traverse every item.
- Track a total or count.
- Find a largest or smallest value.
- Build a new list from selected items.
total = 0
for score in scores:
total += score
average = total / len(scores)
Lists are mutable, so be deliberate when changing them.