-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #1433
base: master
Are you sure you want to change the base?
Solution #1433
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on your code! While there are some minor improvements that can be made, none of them significantly impact the functionality of your code. Keep up the good work! 😊 Remember, always strive to improve your code quality and readability. Don't forget to consider the suggestions for your future tasks. Keep coding! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
def __init__(self, number: int) -> None: | ||
self.number = number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good practice to add docstrings in your classes and methods. Even though your class and method names are descriptive, it's always a good idea to add a docstring explaining what the class or method does. This is especially useful for other developers who might use your code.
def movie_session(self, movie_name: str, customers: list[Customer], | ||
cleaning_staff: Cleaner) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using a list of Customer
objects and a Cleaner
object as parameters to the movie_session
method. It would be a good idea to check if these parameters are of the expected types before using them. This will make your code more robust and prevent potential bugs.
print(f'"{movie_name}" started in hall number {self.number}.') | ||
for customer in customers: | ||
customer.watch_movie(movie_name) | ||
print(f'"{movie_name}" ended.') | ||
cleaning_staff.clean_hall(self.number) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using print statements for logging the start and end of the movie. This is fine for a small program, but in a larger application, it's better to use a logging framework. This will give you more control over the logging level, format, and destination. Additionally, it's a good idea to separate the logic of handling customers and cleaning staff. This will make your code more modular and easier to test and maintain.
app/main.py
Outdated
# write you code here | ||
pass | ||
def cinema_visit(customers: list, hall_number: int, | ||
cleaner: str, movie: str) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function signature is not very clear. It's not obvious what 'cleaner' argument is supposed to be. It would be better to rename it to 'cleaner_name' to make it more explicit.
app/main.py
Outdated
for bar_sell in customers: | ||
customer = Customer(bar_sell["name"], bar_sell["food"]) | ||
list_of_customer.append(customer) | ||
bar_func.sell_product(product=bar_sell["food"], customer=customer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name 'bar_sell' is not very descriptive, it would be better to rename it to something more meaningful, like 'customer_info'.
list_of_customer.append(customer) | ||
bar_func.sell_product(product=bar_sell["food"], customer=customer) | ||
|
||
CinemaHall.movie_session(self=hall, movie_name=movie, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'self' parameter is not needed when calling a method on an instance. You should remove it.
app/main.py
Outdated
hall_number = 5 | ||
cleaner = "Anna" | ||
movie = "Madagascar" | ||
cinema_visit(customers=customers, hall_number=5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're using hardcoded values for 'hall_number' and 'cleaner' arguments here, but you have already defined variables for these values. You should use the variables instead.
class Cleaner: | ||
|
||
def __init__(self, name: str) -> None: | ||
self.name = name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good practice to use type hinting for instance variables as well. In this case, you can add ': str' to 'self.name' for better readability and maintainability of the code. For example: 'self.name: str = name'.
self.name = name | ||
|
||
def clean_hall(self, hall_number: int) -> None: | ||
print(f"Cleaner {self.name} is cleaning hall number {hall_number}.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method 'clean_hall' currently prints a message to the console. While this is fine for testing, in a real-world application, you might want to consider logging this information instead of printing it. This would allow you to keep track of the cleaning activities in a more structured way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
No description provided.