Answers for "how to loop through dictionary in order"

11

python loop through dictionary

d = {'x': 1, 'y': 2, 'z': 3} 
for key in d:
    print key, 'corresponds to', d[key]
Posted by: Guest on May-18-2020
1

traversing dictionary in python

#traversing dictionary function
d={1:'one',2:'two',3:'three',4:'four'}
print(d)
for i in d:
       print(i,d[i])
Posted by: Guest on December-22-2021

Code answers related to "how to loop through dictionary in order"

Python Answers by Framework

Browse Popular Code Answers by Language