Advertisement
Nenogzar

Untitled

Nov 5th, 2023
758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. train_ticket_cost = 150
  2. maximum_prices = {
  3.     "Clothes": 50.00,
  4.     "Shoes": 35.00,
  5.     "Accessories": 20.50
  6. }
  7.  
  8. collection_items, budget = input().split("|"), float(input())
  9. old_budget = budget
  10. new_list = []
  11. sold_items = []
  12.  
  13. for item_data in collection_items:
  14.     item_type, item_price = item_data.split("->")
  15.     item_price = float(item_price)
  16.  
  17.     if item_type in maximum_prices and item_price <= maximum_prices[item_type] and budget >= item_price:
  18.         budget -= item_price
  19.         sold_items.append(item_type)
  20.         new_list.append((item_type, item_price))
  21.  
  22. sold_item_prices = [item[1] * 1.4 for item in new_list if item[0] in sold_items]
  23. profit = sum(sold_item_prices) - sum(item[1] for item in new_list if item[0] in sold_items)
  24. new_dujet= old_budget + profit
  25. #print("new_dujet", new_dujet)
  26.  
  27. print(" ".join([f"{price:.2f}" for price in sold_item_prices]))
  28. print(f"Profit: {profit:.2f}")
  29.  
  30. if 150 <= new_dujet:
  31.     print("Hello, France!")
  32. else:
  33.     print("Not enough money.")
Tags: hello france
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement