Question: [ 4 marks ] 5 . Lambda with Built - in Functions - Sorting: You have a list of tuples where each tuple contains the
marks
Lambda with Builtin Functions Sorting: You have a list of tuples where each tuple contains the name of a product and its corresponding price. Use a lambda function as a key argument to the sorted function to sort these products by price in ascending order. Print the sorted list.
products
marks
Bonus: Lambda for Custom Sorting: Imagine you have a list of dictionaries where each dictionary contains information about a book, specifically its title and the year it was published. Write a lambda function to sort the list of books by year of publication, from the oldest to the newest. Print the sorted list. marks
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
