Answers for "loop through dictionary key values"

123

python iterate dictionary key value

a_dict = {'color': 'blue', 'fruit': 'apple', 'pet': 'dog'}
for key, value in a_dict.items():
  print(key, '->', value)
Posted by: Guest on December-13-2019
1

Dictionary Loop thru a dictionary's keys.

dd = {'john':3, 'mary':4, 'joe':5, 'vicky':7}

for kk in dd:
    print(kk)

# john
# mary
# joe
# vicky
Posted by: Guest on December-10-2021

Code answers related to "loop through dictionary key values"

Python Answers by Framework

Browse Popular Code Answers by Language