-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 #1741
base: master
Are you sure you want to change the base?
Solution #1741
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 implementing the Car
and CarWashStation
classes! 🚗🧼 Your code meets the task requirements and constraints effectively. While there are a couple of minor issues, such as the redundant condition check and the potential for unexpected results in the washing price calculation, these do not significantly impact the functionality. Keep up the good work, and consider these suggestions for future improvements to make your code even more robust and maintainable! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
price = (car.comfort_class * | ||
(self.clean_power - car.clean_mark) * | ||
self.average_rating / | ||
self.distance_from_city_center) |
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 calculation of the washing price could lead to unexpected results due to the order of operations. Consider using parentheses to make the intended order explicit, especially around the division and multiplication operations.
def serve_cars(self, cars: List[Car]) -> float: | ||
total_income = 0.0 | ||
for car in cars: | ||
if car.clean_mark < self.clean_power: |
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 condition car.clean_mark < self.clean_power
is checked twice, here and in the wash_single_car
method. This is redundant and could be optimized by calling wash_single_car
directly and letting it handle the condition.
No description provided.