From 56faf819c626fb725f012a561485dd9d49dde3b7 Mon Sep 17 00:00:00 2001 From: Arsen Markotskyi Date: Sun, 21 Jul 2024 19:14:07 +0300 Subject: [PATCH] "sol" --- app/main.py | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/app/main.py b/app/main.py index 6a12732b..49e271b9 100644 --- a/app/main.py +++ b/app/main.py @@ -9,27 +9,20 @@ def shop_trip() -> None: config = json.load(file) fuel_price = config["FUEL_PRICE"] - customers = [] - shops = [] for config_customer in config["customers"]: - car = Car( - config_customer["car"]["brand"], - config_customer["car"]["fuel_consumption"] - ) - customer = Customer( - config_customer["name"], config_customer["product_cart"], - config_customer["location"], config_customer["money"], car - ) - customers.append(customer) - - shops = [ - Shop(config_shop["name"], - config_shop["location"], - config_shop["products"]) - for config_shop in config["shops"] - ] - + customers = [ + Customer( + config_customer["name"], + config_customer["product_cart"], + config_customer["location"], + config_customer["money"], + Car(**config_customer["car"]) + ) + for config_customer in config["customers"] + ] + + shops = [Shop(**config_shop) for config_shop in config["shops"]] for customer in customers: print(f"{customer.name} has {customer.money} dollars") trips = []