#  1
x = [ [5,2,3], [10,8,9] ] 
students = [
    {'first_name':  'Michael', 'last_name' : 'Jordan'},
    {'first_name' : 'John', 'last_name' : 'Rosales'}
]
sports_directory = {
    'basketball' : ['Kobe', 'Jordan', 'James', 'Curry'],
    'soccer' : ['Messi', 'Ronaldo', 'Rooney']
}
z = [ {'x': 10, 'y': 20} ]


# Change the value 10 in x to 15. Once you're done, x should now be [ [5,2,3], [15,8,9] ].
x[1][0] = 15
# Change the last_name of the first student from 'Jordan' to 'Bryant'
students[0]['last_name'] = 'Bryant'
# In the sports_directory, change 'Messi' to 'Andres'
sports_directory['soccer'][0] = 'Andres'
# Change the value 20 in z to 30
z[0]['y'] = 30


# 2 Iterate Through a List of Dictionaries
# Create a function iterateDictionary(some_list) that, given a list of dictionaries, 
# the function loops through each dictionary in the list and prints each key and the associated value. 
# For example, given the following list:

students = [
    {'first_name':  'Michael', 'last_name' : 'Jordan'},
    {'first_name' : 'John', 'last_name' : 'Rosales'},
    {'first_name' : 'Mark', 'last_name' : 'Guillen'},
    {'first_name' : 'KB', 'last_name' : 'Tonel'}
    ]
def iterateDictionary(students):
    for i in range(0, len(students)):
        for key, val in students[i].items():
            print(f"first_name- {key}, last_name - {val}")

iterateDictionary(students)


# 3 Get Values From a List of Dictionaries
# Create a function iterateDictionary2(key_name, some_list) that, given a list of dictionaries and a 
# key name, the function prints the value stored in that key for each dictionary. For example, 
# iterateDictionary2('first_name', students) should output:

def iterateDictionary2(key_name, students):
    for i in range(0, len(students)):
        print(students[i][key_name])
iterateDictionary2('first_name', students)
iterateDictionary2('last_name', students)


# 4 Iterate Through a Dictionary with List Values
# 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. For example:

dojo = {
    'locations': ['San Jose', 'Seattle', 'Dallas', 'Chicago', 'Tulsa', 'DC', 'Burbank'],
    'instructors': ['Michael', 'Amy', 'Eduardo', 'Josh', 'Graham', 'Patrick', 'Minh', 'Devon']
}
[name, price, ategory, anme., price, category, name]

# def printInfo(list):
#     print(f"{len(list['locations'])} LOCATIONS")
#     for i in range(0, len(list['locations'])):
#         print(list['locations'][i])
#     print(f"{len(list['instructors'])} INSTRUCTORS")
#     for i in range(0, len(list['instructors'])):
#         print(list['instructors'][i])
    

# printInfo(dojo)


#  HOW PROF DID IT BELOW
def iterateDict3(dojo):
    for key, value in dojo.items():
        print(f" {len(value)} {key}")
        for i in range(0,len(value)):
            print(value[i])

iterateDict3(dojo)

#  OR THIS WAY
dojo = {
    'locations': ['San Jose', 'Seattle', 'Dallas', 'Chicago', 'Tulsa', 'DC', 'Burbank'],
    'instructors': ['Michael', 'Amy', 'Eduardo', 'Josh', 'Graham', 'Patrick', 'Minh', 'Devon']
}

def printInfo(list):
    for key, val in list.items():
        print(f"{len(val)} {key.upper()}")
        for i in range(0,len(val)):
            print(val[i])
        print()

printInfo(dojo)