Conversation
| print(f"Author: {max.authors}") | ||
| print(f"Duration: {max.duration}") | ||
| print(f"______________________________") | ||
| return str(max) |
There was a problem hiding this comment.
The method should either return the book, or it should print the book to the console but not both.
| max = b | ||
| # end if | ||
| # end if | ||
| else: |
There was a problem hiding this comment.
The else branch is not needed, because it does not perform any special functionality.
| pass | ||
| # end else | ||
| # end for | ||
|
|
There was a problem hiding this comment.
There is no check that a book was found! If no book was found, accessing the book member variables would throw an error.
| if longest_book is not None: | |
| print(f"Title: {max.title}") | |
| print(f"Author: {max.authors}") | |
| print(f"Duration: {max.duration}") | |
| print(f"______________________________") |
| # Prints crime audio books | ||
| def print_longest_crime_audio_book(self) -> str: | ||
| crime_audio_books: list[Book] = [] | ||
| max: Optional[Book] = None |
There was a problem hiding this comment.
The max variable does not really tell us what this variable should be holding. Renaming it to longest_book would make it clearer
| max: Optional[Book] = None | |
| longest_book: Optional[Book] = None |
| max: Optional[Book] = None | ||
|
|
||
| # print banner | ||
| print("*********************************************") |
There was a problem hiding this comment.
This will printed even if no book was found. Should maybe be inside the a condition.
| return str(max) | ||
|
|
||
| # Constructor | ||
| def __init__(self, books: list[Book]): |
There was a problem hiding this comment.
Constructor and member variables should be at the top of the class and commented
No description provided.