question archive Assume that you have a list with tuples
Subject:Computer SciencePrice: Bought3
Assume that you have a list with tuples. The tuples have 3 elements: the year a book was published, the book title, and the rating. Writee a function that takes a list of the above-defined tuples and a string and sorts the list using insertion sort. If the string is "year", the function sorts the list of tuples by year in ascending order. If the string is "book" the function sorts the list of tuples alphabetically by book title. If the string is "rating" the function sorts the list of tuples by rating in descending order.
Note: You can repeat exercise 2 using selection sort and bubble sort