Free practice · ordering · medium

Practice

Order a dictionary-summary trace

Arrange the steps for totaling values in a validated dictionary.

Collection contract

Choose access by the relationship the data represents

List
Ordered items accessed by index or iteration
Dictionary
Values accessed by stable keys
Boundary
Empty, one-item, and several-item states
Mutation
One deliberate, traceable change
Reconciliation
Expected size, keys, counts, and totals

Lists use ordered positions; dictionaries use meaningful keys. Both need shape, missing-data, mutation, and boundary checks.

Arrange in the correct order
  1. 1. Return total after the loop
  2. 2. Add the current value to total
  3. 3. Visit each key and value once
  4. 4. Set total to 0
  5. 5. Confirm the mapping is present and values are numeric