This week, we are going to take a look at how to implement search functions.
To start, we're going to create a library to search. We'll use Peter's library project (can also use my version) and the text file of books from MakingLibrarySoftware5. We'll need to read that file and use the mass_add method on his library.
Next, we'll brainstorm what a good search function looks like and break up into groups to implement those functions.
- write a script to add the books from titles.txt using
mass_add - brainstorm how to implement a search function that looks like this:
def search(self, title='', author=''):
"""
search by title, author, or both
"""
- how can you make the searching more flexible? more efficient?