Question: books _ by _ author Define a function named books _ by _ author with two parameters; the first is of type str denoting an
booksbyauthor
Define a function named booksbyauthor with two parameters; the first is of
type str denoting an intended author name and the second is of type listBookBook is
defined in the provided data.py file This function must return a list of all books of type
listBook in the input list written by the author specified in the first parameter.
This function might be used to find books by a favorite or a recommended author.# Representation of a book.
class Book:
# Initialize a new Book object.
# input: the book's authors as a list of strings
# input: the book's title as a string
def self authors: liststr title: str:
self.authors authors
self.title title
# Provide a developerfriendly string representation of the object.
# input: Book for which a string representation is desired.
# output: string representation
def repr self:
return "Bookformatargs: self.authors, self.title
# Compare the Book object with another value to determine equality.
# input: Book against which to compare
# input: Another value to compare to the Book
# output: boolean indicating equality
def eq self other:
return self is other or
typeother Book and
self.authors other.authors and
self.title other.title
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
