Create a function printInfo(some_dict) that given a dictionary whose values are all lists, prints the name of each key along with the size of its list, and then prints the associated values within each key's list.

Respuesta :

Answer:

def printInfo(some_dict):

   print(len(some_dict['locations']), "LOCATIONS")

   for location in some_dict['locations']:

       print(location)

   print()

   print(len(some_dict['instructors']), "INSTRUCTORS")

   for location in some_dict['instructors']:

       print(location)

seattle = {

   'locations': ['San Jose', 'Seattle', 'Dallas', 'Chicago', 'Tulsa', 'DC', 'Burbank'],

   'instructors': ['Michael', 'Amy', 'Eduardo', 'Josh', 'Graham', 'Patrick', 'Minh', 'Devon']

}

printInfo(seattle)

Explanation:

Otras preguntas