Question: Please answer in Python (no imports, no list comprehensions, only for loops and built-in python functions) Write a function that takes in a dictionary of
Please answer in Python (no imports, no list comprehensions, only for loops and built-in python functions)
Write a function that takes in a dictionary of the form described above and returns a list of unique items from the dictionary lists, sorted alphabetically. If there is no item (either because the input dictionary is empty or all value lists in the dictionary are empty), return an empty list.
Hint: You may use the built-in sorted() function to sort the list.
def no_repeats(collections): """ >>> exploration_1 = {'team1': ['blue dartwing', 'elves ear'], \ 'team2': ['hawk beak', 'histcarp']} >>> no_repeats(exploration_1) ['blue dartwing', 'elves ear', 'hawk beak', 'histcarp']
>>> exploration_2 = {'team1': ['deathbell', 'deathbell'], 'team2': []} >>> no_repeats(exploration_2) ['deathbell'] >>> exploration_3 = {'team1': ['deathbell'], \ 'team2': ['blue dartwing', 'histcarp'], 'team3': ['histcarp']} >>> no_repeats(exploration_3) ['blue dartwing', 'deathbell', 'histcarp']
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
