Give the Book Back
Python
25 pts
Give the Book Back
The Book class can already be borrowed. Add a new method called give_back that sets available back to True. Copy the style of borrow.
Then, using the book object, print its status, borrow it, print again, give it back and print a third time. Each line uses the form title: available, for example print(f"{book.title}: {book.available}").
Expected output:
Python for Beginners: True Python for Beginners: False Python for Beginners: True
Checklist
- Add a method called
give_backto theBookclass that makes the book available again. - Using
book, print its status, borrow it, print again, give it back and print a third time.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
