Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question: Given a dictionary that maps a person to a list of their favorite GT traditions, return a dictionary with the value being the list

Question: Given a dictionary that maps a person to a list of their favorite GT 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']

Please provide the python code and resulting output.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions

Question

Identify cultural barriers to communication.

Answered: 1 week ago