from dataclasses import dataclass from typing import List @dataclass class Book: """Represents a book with title and author""" title: str author: str class Library: """Represents a library with a collection of books""" def __init__(self): self.books: List[Book] = [] def add_book(self, book: Book): """Adds a book to the library""" self.books.append(book) def list_books(self): """Lists all books in the library""" for book in self.books: print(f"Title: {book.title}, Author: {book.author}") def main(): """Main entry point of the application""" library = Library() book1 = Book("To Kill a Mockingbird", "Harper Lee") book2 = Book("1984", "George Orwell") library.add_book(book1) library.add_book(book2) library.list_books() if __name__ == "__main__": main()