Skip to content

Commit

Permalink
'Solution'
Browse files Browse the repository at this point in the history
  • Loading branch information
tiron-vadym committed Oct 18, 2023
1 parent 1e5ba14 commit 34e3d33
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,26 @@ def shop_trip() -> None:
print(f"\nDate: "
f"{datetime.datetime.now().strftime('%d/%m/%Y %H:%M:%S')}")
print(f"Thanks, {customer.name}, for your purchase!")
print("You have bought:")
print("You have bought: ")
for item, quantity in customer.product_cart.items():
cost = best_shop.products[item] * quantity
if isinstance(cost, float) and cost.is_integer():
cost = int(cost)
print(f"{quantity} {item}s for {round(cost, 2)} dollars")
print(f"Total cost is "
f"{round(customer.calculate_product_cost(best_shop), 2)}"
f" dollars")
print("See you again!\n")

customer.money -= cheapest_cost

print(f"{customer.name} rides home")
print(f"{customer.name} now has "
f"{round(customer.money, 2)} dollars\n")
else:
print(f"{customer.name} doesn't have enough money "
f"to make a purchase in any shop")

print(f"{customer.name} rides home")
print(f"{customer.name} now has {round(customer.money, 2)} dollars")


if __name__ == "__main__":
shop_trip()

0 comments on commit 34e3d33

Please sign in to comment.