Question: 15.16.2. Create More Book Objects Change the following main function to create a third book object called b3 with a title of 1984 and author

15.16.2. Create More Book Objects Change the following main function to create a third book object called b3 with a title of 1984 and author George Orwell. Print out the values using the print function in the main.

class Book: """ Represents a book object """

def __init__(self, title, author):

self.title = title self.author = author def __str__(self):

return "title: " + self.title + " author: " + self.author def get_title(self):

return self.title def get_author(self): return self.get_author def set_author(self, author):

self.author = author def set_title(self, title): self.title = title def main():

b2 = Book("A Wrinkle in Time", "M. L'Engle") print(b2) b2.set_author("Madeleine L'Engle") print(b2) b1 = Book("Goodnight Moon", "Margaret Wise Brown") print(b1) main()

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 Databases Questions!