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 leveragingto pull out an index value alongside the returned tuple.
enumerate(stats.items()) - Print strings formatted exactly:...
[0] HP: 100
main.py
main.py
Ctrl + Enter