@extends('template') @section('title') Lab 8, Part 3: Inverting a dictionary @stop @section('content') # Lab 8: Inverting a dictionary ## Building a reverse dictionary Remember the cs111dict dictionary we built at the start of lab today? Wouldn't it be cool to be able to create a reverse dictionary where we use the values as the keys? We will return a dictionary where the keys are what used to be the values, and each key has a list of associated values (original keys). For example, our cs111dict has student names as keys and graduation years as values. The reverse dictionary of cs111dict will have the graduation years as keys and the students' names associated with those graduation years as values. For example, {{-- update this example with current students and years --}} ```py reverseCS111Dict = invert_dict(cs111dict) #reverse the cs111dict reverseCS111Dict.keys() ==> ['2017', '2016', '2019', '2018'] reverseCS111Dict['2017'] ==> ['Lia', 'Hikari', 'Minjia', 'Kyra', 'Crystal', 'Sophie','Clarissa'] reverseCS111Dict['2018'] ==> ['Marissa', 'Alexandra', 'Caroline', 'Maya', 'Jessica', 'Andrea', 'Emma','Yasmin', 'Tanya', 'Heankel', 'Kaylie', 'Mojia', 'Madison', 'Mina', 'Rachel', 'Lauren', 'Maria-Alejandra', 'Shaina'] ``` Write your invertDictionary(dict) function so that it takes a dictionary as a parameter and returns a new inverted dictionary. Note that the example above shows reversing the cs111dict, but your function should work for any dictionary. @include('/labs/lab08/_toc') @stop