Python Introducing Dictionaries Iterating and Packing with Dictionaries Iterating Over Dictionaries

Introducing Dictionaries: Challenge Task 1 of 1

Item not defined, should it be automatically defined?

iterating_dictionaries.py
pets = {'name':'Ernie', 'animal':'dog', 'breed':'Pug', 'age':2}

for key, value in pets.items():
    print(item)
    print(key)

1 Answer

Scott Bailey
Scott Bailey
13,176 Points

Have a look at the request in the challenge, it's asking you to print the key and value - these are the values returned from .items()