IGO
0
Q:

python dict enumerate

# Iterate over dictionary using enumerate()

mydict = {
	"one": 1,
  	"two": 2,
  	"three": 3
}

# You can replace `index` with an underscore to ignore the index value
for index, item in enumerate(mydict):
	print(f"{item}:", mydict.get(item))

# OUTPUT:
# one: 1
# two: 2
# three: 3
0
for i, (k, v) in enumerate(example_dict.items()):
    print(i, k, v)
0

New to Communities?

Join the community