Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
mykolamateichuk committed Oct 24, 2023
1 parent 754380d commit 5767b2b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion app/classes/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ def from_dict(cls_dict: dict) -> Customer:
continue
setattr(new_customer, key, cls_dict[key])
return new_customer

2 changes: 1 addition & 1 deletion app/classes/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def from_dict(cls_dict: dict) -> Shop:
return new_shop

def print_receipt(self, customer: Customer) -> float:
print(f"Date: 04/01/2021 12:33:41")
print("Date: 04/01/2021 12:33:41")
print(f"Thanks, {customer.name}, for your purchase!")
print("You have bought:")
total_cost = 0
Expand Down
9 changes: 4 additions & 5 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import app.utilities as util
from app.classes.customer import Customer
from app.classes.car import Car
from app.classes.shop import Shop


Expand All @@ -19,10 +18,10 @@ def shop_trip():
closest_shop = 0
min_cost = 0
for index, shop in enumerate(shops):
trip_cost = 2 * util.calculate_trip_cost(fuel_price,
customer.car.fuel_consumption,
customer.location,
shop.location)
trip_cost = util.calculate_trip_cost(fuel_price,
customer.car.fuel_consumption,
customer.location,
shop.location) * 2

print(f"{customer.name}'s trip to the"
f" {shop.name} costs {trip_cost}")
Expand Down

0 comments on commit 5767b2b

Please sign in to comment.