Question: class Library(): # add your code here def __init__self(): self.books = [] self.tornPageTolerance = 5 def addBook(self,book): self.books.append(book) return (none) def findBooksBy(self,author): for auth_attr in

class Library():

# add your code here

def __init__self():

self.books = []

self.tornPageTolerance = 5

def addBook(self,book):

self.books.append(book)

return (none)

def findBooksBy(self,author):

for auth_attr in self.books:

if auth_attr == auth_attr.author:

return

results in:

 7 def addBook(self,book): ----> 8 self.books.append(book) 9 return (none) 10 AttributeError: 'Library' object has no attribute 'books' 

Navigate back up to the cell containing the Library class and add the methods below. After you add the methods make sure you run the cell.

  • addBook
  1. Accepts the parameterbookwhich is an instance of Book
  2. Appendbooktoself.books
  3. Returns nothing
  • findBooksBy
  1. Accepts the string formal parameter author
  2. Searchs the listself.books
  3. Returns a list of all books whose author attribute matches the author parameter.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!