I want a class "Library" which has a class variable "books" which is a list of all the books in the library. So may class begins
class Library:
books = []
Now I want to add a book to my collection, but I can find no syntax to do so. The model I have in my head is something like
def addBook(self, book):
books.append(book)
which I would expect to call with something like from the main routine with something like
lib = Library()
b = Book(author, title)
lib.addBook(b)
However, I've not been able to find any way to do this. I always get an error with the "append" where I try to add the book to the list.