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 #1861

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

Solution #1861

wants to merge 3 commits into from

Conversation

BuryiOstap
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. There are a couple of minor issues related to type hints that you might want to address for better clarity and compatibility: consider changing the return type of wash_single_car to float, and if you're using Python version earlier than 3.9, use List[Car] from the typing module instead of list[Car]. Keep up the good work and happy coding! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

app/main.py Outdated
self.average_rating = average_rating
self.count_of_ratings = count_of_ratings

def serve_cars(self, cars: list[Car]):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint list[Car] requires Python 3.9 or later. If you're using an earlier version, consider using List[Car] from the typing module.

app/main.py Outdated
/ self.distance_from_city_center))
return round(washing_price, 1)

def wash_single_car(self, car: Car) -> int:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type of wash_single_car is specified as int, but the method actually returns a float value from calculate_washing_price. Consider changing the return type to float.

Copy link

@vsmutok vsmutok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests Failed!

self.count_of_ratings = count_of_ratings

def serve_cars(self, cars: list[Car]) -> int:
income = 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I were you, I would improve this function by replacing the loop with an additional variable to iterate with the use of the usual sum() function. This solution will cost us only 1 line of code and its readability will not deteriorate

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def serve_cars(self, cars: list[Car]) -> int:
    return sum([self.wash_single_car(car) for car in cars])

Something like this?

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.

4 participants