Sichanov

r

Oct 3rd, 2021
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. train_ticket = 150
  2.  
  3. items_dict = {"Clothes": 50.00, "Shoes": 35.00, "Accessories": 20.50}
  4.  
  5. items_list = list(input().split("|"))
  6. budget = float(input())
  7. sales_list = []
  8.  
  9. for item in range(len(items_list)):
  10.     product = items_list[item]
  11.  
  12.     product_name = product.partition("-")[0]
  13.     product_price = float(product.partition(">")[2])
  14.  
  15.     if budget >= product_price:
  16.  
  17.         if product_name in items_dict.keys():
  18.             if product_price <= items_dict[product_name]:
  19.                 sales_list.append(f'{product_price * 1.4:.2f}')
  20.  
  21.                 budget -= product_price
  22.  
  23. print(*sales_list, sep=' ')
  24.  
  25. print(f"Profit: {sum(list(map(float, sales_list))) - sum(list(map(float, sales_list))) / 1.4:.2f}")
  26.  
  27. if (sum(list(map(float, sales_list))) + budget) > train_ticket:
  28.     print("Hello, France!")
  29. else:
  30.     print("Not enough money.")
Advertisement
Add Comment
Please, Sign In to add comment