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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
class Car:
# write your code here
pass
def __init__(self, comfort_class: str, clean_mark: str, brand: str)\

Choose a reason for hiding this comment

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

There is a syntax error in the __init__ method definition. The backslash (\) at the end of the line should be removed, and the colon (:) should be placed at the end of the line to properly define the method.

-> None:
self.comfort_class = comfort_class
self.clean_mark = clean_mark
self.brand = brand


class CarWashStation:
# write your code here
pass
def __init__(self, distance_from_city_center: int, clean_power: int,
average_rating: int, count_of_ratings: int) -> None:
self.distance_from_city_center = distance_from_city_center
self.clean_power = clean_power
self.average_rating = average_rating
self.count_of_ratings = count_of_ratings

def calculate_washing_price(self, car: str) -> None:

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 has an incorrect type hint for the car parameter. It should be Car instead of str, as this method is supposed to work with instances of the Car class.

return round((car.comfort_class * (self.clean_power - car.clean_mark)

Choose a reason for hiding this comment

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

The expression car.comfort_class * (self.clean_power - car.clean_mark) is incorrect because comfort_class and clean_mark are expected to be integers, not strings. Ensure that the Car class is instantiated with integer values for these attributes.

* self.average_rating)
/ self.distance_from_city_center, 1)

def wash_single_car(self, car: str) -> None:

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 has an incorrect type hint for the car parameter. It should be Car instead of str, as this method is supposed to work with instances of the Car class.

if car.clean_mark < self.clean_power:
car.clean_mark = self.clean_power

def serve_cars(self, cars: str) -> None:

Choose a reason for hiding this comment

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

The serve_cars method has an incorrect type hint for the cars parameter. It should be a list of Car objects (e.g., List[Car]) instead of str, as this method is supposed to work with a list of Car instances.

income = 0
for car in cars:
if car.clean_mark < self.clean_power:
income += self.calculate_washing_price(car)
self.wash_single_car(car)
return round(income, 1)

def rate_service(self, rating: int) -> None:
total_rating = (self.average_rating * self.count_of_ratings) + rating
self.count_of_ratings += 1
self.average_rating = round(total_rating / self.count_of_ratings, 1)
Loading