Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Solution #1741

wants to merge 2 commits into from

Conversation

dmytro0908
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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! ✨

Comment on lines +20 to +23
price = (car.comfort_class *
(self.clean_power - car.clean_mark) *
self.average_rating /
self.distance_from_city_center)

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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants