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

implement classes for py-car-wash-station #1769

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ihetay
Copy link

@ihetay ihetay commented Dec 25, 2024

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. 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! ✨

Comment on lines +13 to +16
if distance_from_city_center <= 0:
raise ValueError(
"Distance from city center must be greater than 0"
)

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.

Comment on lines +23 to +24
result = (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 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.

Comment on lines +28 to +29
if car.clean_mark < self.clean_power:
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 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.

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