Python: Enumeration Over Dictionary
Posted: Tue Apr 07, 2026 5:47 pm
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}"