Search for question
Question

Question 3:

Write a function return_book that takes a book ID. If the book is not

available in the borrowed_books, tell the user that they are trying to

return a book that does not exist. However, if the book is in the list of

borrowed books, remove it from the list, and add it to the

library_books list. Also, if the returned book is in the requested_books

list, remove it from that list as well. Finally, implement a code that

keeps track of the number of times a book has been borrowed. This

may require a change in the data structures used. Whenever a book is

returned, increment the number of times it was borrowed.

Example output: If the user returns a book with an ID that currently

exists in the borrowed_books list, the system displays a message like

this one:

The book with the ID 001 is successfully returned.

If the user attempts to return a book with an ID that does not exist in

the borrowed_books list, the system displays a message like this one:

The book with the ID 125 cannot be returned. Please re-check the

ID.

Fig: 1