Python Program to Iterate Over Dictionaries Using for Loop (Return keys or values explicitly)

bookmark

dt = {'a': 'juice', 'b': 'grill', 'c': 'corn'}

for key in dt.keys():
    print(key)

for value in dt.values():
    print(value)

 

Output

a
b
c
juice
grill
corn