-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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' #1739
base: master
Are you sure you want to change the base?
'Solution' #1739
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, and the logic for washing cars, calculating prices, and updating ratings is correctly implemented. While there are a few areas to double-check against the task description, such as the rounding in rate_service
and the logic in calculate_washing_price
and wash_single_car
, these are minor and don't impact the overall functionality. Keep up the good work, and consider reviewing these areas for future improvements! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
def serve_cars(self, cars: List[Car]) -> float: | ||
total_income = 0 | ||
for car in cars: | ||
if car.clean_mark < self.clean_power: | ||
total_income += self.calculate_washing_price(car) | ||
self.wash_single_car(car) | ||
return round(total_income, 1) |
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 serve_cars
method correctly iterates over the list of cars and calculates the total income from washing. However, ensure that the calculate_washing_price
and wash_single_car
methods are correctly implemented and that their logic aligns with the task requirements.
def calculate_washing_price(self, car: Car) -> float: | ||
result = (car.comfort_class * (self.clean_power - car.clean_mark) * self.average_rating / self.distance_from_city_center) | ||
return round(result, 1) |
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 calculate_washing_price
method calculates the price based on the comfort class, cleanliness, and other factors. Ensure that the formula used here is correct according to the task requirements. If there are specific constraints or conditions mentioned in the task description, verify that they are being met.
def wash_single_car(self, car: Car) -> None: | ||
if self.clean_power > car.clean_mark: | ||
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 wash_single_car
method updates the car's clean mark to the station's clean power if it's greater. This logic seems correct, but make sure it aligns with the task requirements.
def rate_service(self, rate: float) -> None: | ||
total_rating = self.average_rating * self.count_of_ratings | ||
total_rating += rate | ||
self.count_of_ratings += 1 | ||
self.average_rating = round(total_rating / self.count_of_ratings, 1) |
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 rate_service
method updates the average rating based on a new rate. The logic for updating the average rating is correct, but ensure that the rounding and calculation meet any specific requirements from the task description.
No description provided.