01 / 07
By number, or by name
With two containers to choose from it is not always obvious which to reach for. The rule of thumb is this.
- Several of the same kind of thing in a row — a list. "Five scores", "three fruits"
- The parts that make up one thing — a dictionary. "A name, a price and a count"
Last lesson the names, prices and counts sat in three separate lists. That was one record pulled apart and forced to live in pieces.