python: def traditions_dict(adict): """ Question 6 Given a dictionary that maps a person to a list of their favorite traditions, return a dictionary with the value being the list sorted by the last letter of each tradition. If two traditions have the same last letter, sort by the first letter. HINT: This will require the use of lambda functions Args: adict (dict) Returns: dict
python:
def traditions_dict(adict):
"""
Question 6
Given a dictionary that maps a person to a list of their favorite traditions, return a dictionary with the value being
the list sorted by the last letter of each tradition. If two
traditions have the same last letter, sort by the first letter.
HINT: This will require the use of lambda functions
Args:
adict (dict)
Returns:
dict
>>> traditions_dict({"Jacob": ["The Horse", "Stealing the t", "Midnight Bud"],
"Athena": ["Mini Five-Hundred", "Freshman Cake Race", "Buzzweiser Song"],
"Liv": ["Freshman Cake Race", "George P. Burdell", "Buzzweiser Song"]})
{'Jacob': ['Midnight Bud', 'The Horse', 'Stealing the t'],
'Athena': ['Mini Five-Hundred', 'Freshman Cake Race', 'Buzzweiser Song'],
'Liv': ['Freshman Cake Race', 'Buzzweiser Song', 'George P. Burdell']}
>>> traditions_dict({"Madison": ["The Horse", "Midnight Bud", "Buzzweiser Song"],
"Anna": ["Mini Five-Hundred", "Buzzweiser Song", "Freshman Cake Race"],
"Ashok": ["The Horse", "Freshman Cake Race", "Stealing the t", "Midnight Bud"]})
{'Madison': ['Midnight Bud', 'The Horse', 'Buzzweiser Song'],
'Anna': ['Mini Five-Hundred', 'Freshman Cake Race', 'Buzzweiser Song'],
'Ashok': ['Midnight Bud', 'Freshman Cake Race', 'The Horse', 'Stealing the t']}
# classes_dict = {4232: ["ISYE", "MATH", "HTS"], 2316: ["CS", "CX", "MGT"], 3000: ["ISYE", "MGT", "ECE"], 2027: ["ISYE", "PSYC", "HTS"]}
# print(classes(classes_dict, "ISYE"))
# print(classes(classes_dict, "CS"))
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)