Checkpoint

Checkpoint: The Cargo Manifest

The cargo ship Glimmer is about to sail. Before it leaves, the quartermaster needs a manifest: a list of what's on board and how heavy it all is.

Each piece of cargo is a tuple (item, kg). This checkpoint uses the whole chapter: lists, append, looping over a list, unpacking tuples and adding up totals.

Assignment

Use one for loop over manifest:

  1. Unpack each pair into item and kg.
  2. Append every item to names.
  3. Add every kg to total.
  4. If kg is more than 5, also append the item to heavy.

The prints are written for you. The output should be:

Items: rope, oil, map, gem
Total: 26 kg
Heavy: oil, gem