You have store credit of dollars. However, you don’t want to walk a long distance with heavy books, but you want to spend all of your store credit.
Let’s say we have a list of books in the format of tuples where the first value is the price and the second value is the weight of the book -> (price,weight).
Write a function
optimal_books to retrieve the combination that allows you to spend all of your store credit while getting at least two books at the lowest weight.
Note: You should spend all your credit and getting at least 2 books, If no such condition is satisfied just return
Next question: Free Seats
N = 18 books = [(17,8), (9,4), (18,5), (11,9), (1,2), (13,7), (7,5), (3,6), (10,8)] def optimal_books(N, books) -> [(17,8),(1,2)]