Python: Enumeration Over Dictionary

Post Reply
User avatar
Jason
Site Admin
Posts: 767
Joined: Sun Dec 21, 2025 8:56 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}"
 

POSTREACT(ions) SUMMARY

Post Reply