Given below is a function that returns a dictionary of the number of times you attend a class in one week. Rearrange the
Posted: Mon Jun 06, 2022 5:49 pm
Given below is a function that returns a dictionary of the number of times you attend a class in one week. Rearrange the lines of code below so that the function works as expected. For example, if the input parameter is time_table = {"Mon": ['CSE 170'], "Tue": ['CSE 8A', 'CSE 256'], "Wed": ['CSE 170'], "Thu": ['CSE 8A', 'CSE 256'], "Fri": ['CSE 170']}, then this function should return {'CSE 170': 3, 'CSE 8A': 2, 'CSE 256': 2}. Note that you should make sure the indentation is correct! Drag from here Drop blocks here for subject in subjects: if subject not in subject_freq: subject_freq [subject] = 1 for subjects in timetable.values(): else: subject_freq = {} def subject frequency (timetable): return subject_freq subject_freq [subject] += 1