Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def buy_items_and_calculate_profit(items, budget):
- max_prices = {"Clothes": 50.00, "Shoes": 35.00, "Accessories": 20.50}
- bought_items = []
- total_profit = 0
- for item in items:
- item_type, price = item.split("->")
- price = float(price)
- if price <= max_prices[item_type] and budget >= price:
- budget -= price
- bought_items.append(price * 1.4)
- total_profit += price * 0.4
- return bought_items, total_profit, budget
- def main():
- items_input = input().split("|")
- budget = float(input())
- bought_items, profit, remaining_budget = buy_items_and_calculate_profit(items_input, budget)
- total_budget = sum(bought_items) + remaining_budget
- print(" ".join(f"{price:.2f}" for price in bought_items))
- print(f"Profit: {profit:.2f}")
- if total_budget >= 150:
- print("Hello, France!")
- else:
- print("Not enough money.")
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement