Let's do an exercise. We're going to create a grade attendance book for a teacher's students, and it's going to contain a dictionary of dictionaries. So we're going to start by creating a dictionary for each student. So for Billy, we'll have a dictionary, where the key is the name, and the value is Billy. Key is grades and the value is a list of grades 100, 80, 67, 100, 89. And then the key is attendance, and the value is a list of Boolean values, True, True, True, True, True, perfect attendance. The other students will have a similar format in their dictionaries. So will create a dictionary for Sarah. Name, Sarah. Grades, here's the list, 0, 99, 0, 100, and 0 kind of all over the place. Attendance, True, False, True, False, True. Finally, third student, Ben, create a dictionary. Name is Ben. Grades, 60, 82, 71, 92. Attendance, False, False, False, False, False. Not good. Now we're going to add each student to another dictionary using a unique student ID for each student. So students will be another dictionary, the key will be 1, the string 1. And what's the value? The dictionary for Billy, 2. What's the value the dictionary for Sarah? 3, what's the value dictionary Ben? Save that. Get the length or number of students. Get number of students. So we can actually get the length of the student's dictionary. This is actually the number of keys. We'll print that. There are three students, no surprise there. We can get all of the student IDs or just the keys, so get all student IDs for the students dictionary, going to call the keys method. This gets all keys in the dictionary. We'll go ahead and print that, it's actually going to return a dict Keys object containing the keys. Dict keys object and what are the keys 1, 2 and 3. We can also just iterate over the dictionary to get the keys, so iterate over students. So 4 key in students. Let's print let's say key. Okay, this will print just the keys. Let's run that, what are the keys 1, 2 and 3? Let's get Billy's attendance. Okay, so get Billy's attendance. Okay, so let's go ahead and get the dictionary associated with the first key in students, key 1, that's actually going to be Billy. All right, that'll be his dictionary, and then let's print from the Billy dictionary, the value associated with the Attendance key. It was Billy's attendance. Let's get Sarah's grades, gets Sarah's grades. So from the students dictionary, let's get the value associated with the key to, that will be Sarah's dictionary. And then we're going to print from Sarah the value associated with the key grades. Those are Sarah's grades. Now let's get all the key value pairs associated with Ben. Get all key value pairs for Ben. How do we get Ben? So from the student's dictionary, get the value associated with key 3, this is going to be Ben's dictionary, then for Ben we're going to call the items method. And this basically returns a sequence of tuples where the first item is the key. The second item is the value. We'll call these items and then we can iterate over those items. So for key and value in items, let's print the key and the value. This is Ben's information, name, Ben. Grades, list of grades. Attendance, list of Boolean values. Let's get the average student grade for all assignments. Okay, so let's go ahead and get average student grade for all assignments. So we're going to start by creating an empty list called grades. Then we're going to get all of the key value pairs associated with student. So what's the key? The student ID and what's the value? Each student dictionary. So students.items, call those items. And these are key value pairs for students. Then we're going to iterate over those key value pairs. So for key val in Items. Remember the key is the student ID, the val or the value, in this case is actually the student. So let's iterate over the student's list of grades. For G in val, that's the student looking at the Grades key. Iterate over those grades, and then add it to our list G, then we have all of the grades for all students in this list. Then let's go ahead and print, we'll get the sum of the grades, we'll divide it by the length of the grades, and just for fun let's go ahead and round it off. So this is average grade. Let's run that. Average grade for all assignments is 69, and there's an even easier way to do this. We're actually just going to concatenate the lists of grades. So let's go ahead and do this another way. Another way to do this, we'll start by creating Grades Concatenated. That's an empty list so we're starting the same way, then we'll get the key value pairs associated with the students. So students.items, right? Again, this is key value pairs for students. What are the keys? The student IDs. What are the values? The student dictionaries. We'll call that items, we're going to iterate over those. So for each key value in items, we're then going to get just the list of grades for each student, and we're going to add it to our Grades Concatenated list. So for each student, that's the value, get the grades. There's the key I want to get the value which is the grades. We're going to add this list of grades to this list. We can add lists and all it really does is append those values to the end of the list. So concatenate list of grades, And then we're going to actually just print the average in the same way, except we're going to use Grades Concatenated, and Grades Concatenated, we'll run that. Again, the average grade for all assignments is 69.