-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
implementing CarWashStation and Car classes #1919
base: master
Are you sure you want to change the base?
Conversation
God job! Everything looks clean. |
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! 🎉 The code meets the task requirements and constraints, and the methods are implemented correctly. While there is a minor redundancy with the condition self.clean_power > car.clean_mark
being checked twice, it doesn't affect the functionality. Keep up the good work, and consider refining the code to remove such redundancies in the future for cleaner and more efficient code. Well done! 😊
✨ 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: | ||
income = 0.0 | ||
for car in cars: | ||
if self.clean_power > car.clean_mark: |
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 self.clean_power > car.clean_mark
is checked twice: once in serve_cars
and again in wash_single_car
. This redundancy can be avoided by assuming the condition is met before calling wash_single_car
.
* self.average_rating / self.distance_from_city_center, 1) | ||
|
||
def wash_single_car(self, car: Car) -> None: | ||
if self.clean_power > car.clean_mark: |
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.
As mentioned earlier, the condition self.clean_power > car.clean_mark
is redundant here since it is already checked in the serve_cars
method before calling wash_single_car
. Consider removing this condition.
No description provided.