Answer:
- class Library:
- def __init__(self):
- self.books = []
- lib1 = Library()
- lib1.books.append("Biology")
- lib1.books.append("Python Programming Cookbook")
Step-by-step explanation:
The solution code is written in Python 3.
Firstly, we can create a Library class with one constructor (Line 2). This constructor won't take any input parameter value. There is only one instance variable, books, in the class (Line 3). This instance variable is an empty list.
To test our class, we can create an object lib1 (Line 5). Next use that object to add the book item to the books list in the object (Line 6-8).