Python Introducing Dictionaries Iterating and Packing with Dictionaries Recap of Iterating and Packing with Dictionaries

Thomas Ma
Thomas Ma
15,199 Points

Complete this code so that it will iterate over all the key:value pairs in the student dictionary.

Help plz

1 Answer

volhaka
volhaka
8,380 Points

there is a dictionary method that we can returns list of key, value pairs - items() eg. dict_name.items() so if we want to print key and value for each item in dictionary :

for key, value in dict_name.items():
     print(key)
     print(value)