12345
Back to Lesson

Enumerating Dict Iteration

Combine enumerate mapping atop dictionary structures.

Instructions

  • Given an ordered dictionary representation (in 3.7+ this defines chronological entries)
  • stats = {"HP": 100, "MP": 50, "SPD": 12}
    .
  • Use a loop leveraging
    enumerate(stats.items())
    to pull out an index value alongside the returned tuple.
  • Print strings formatted exactly:
    [0] HP: 100
    ...
main.py
main.py