-
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
implement classes for py-car-wash-station #1769
base: master
Are you sure you want to change the base?
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. The logic for calculating washing prices and updating car cleanliness is sound, and you've handled potential division by zero issues well. Keep up the good work, and consider reviewing the logic for updating car.clean_mark
to ensure it aligns with your intended behavior. Happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
if distance_from_city_center <= 0: | ||
raise ValueError( | ||
"Distance from city center must be greater than 0" | ||
) |
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 check for distance_from_city_center
being less than or equal to zero is correctly implemented to prevent division by zero in the calculate_washing_price
method. Ensure this check is maintained to avoid runtime errors.
result = (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 formula for calculating the washing price is correct, but ensure that distance_from_city_center
is never zero to prevent division by zero errors. This is already handled in the constructor, so no changes are needed here.
if car.clean_mark < self.clean_power: | ||
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 logic here updates car.clean_mark
to self.clean_power
if it is less than self.clean_power
. This is correct, but ensure that this is the intended behavior, as it will set the clean mark to the station's clean power regardless of the car's initial clean mark.
No description provided.