Page 1 of 1

Python: Enumeration Over Dictionary

Posted: Thu Sep 11, 2025 1:25 am
by The Jason

Code: Select all

dictionary_of_some_NHL_teams = dict(San Jose = "Sharks", Nashville = "Predators", Carolina = "Hurricanes")

for index, (key, value) in enumerate(dictionary _of_some_NHL_teams.items()):

	print(f "Index: {index}, Key: {key}, Value: {value}"