We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Classes Practice

Wizards are having a hard time keeping track of all the books in their library. They need your help to create a library system that will allow them to add, remove, and search for books.

Magical incantations to find books have unfortunately not been invented yet.

Assignment

You've been tasked with writing the code for the wizard library. Complete the Library and Book classes listed below.

      When removing items, it is safer to create a new list of what you want to keep. Deleting items directly during a loop shifts the indices of the remaining items, causing the loop to skip data.

After a book is removed, it should no longer be returned in the search results.

Tips

  • You can use the .lower() method to convert a string to lowercase.
  • Avoid modifying a list while looping over it because it can skip items or cause errors; instead, create a new list with the items you want to keep or loop over a copy.