Advertisement
Guest User

hello-france

a guest
Jun 11th, 2020
603
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.98 KB | None | 0 0
  1. collection = input()
  2. budget = float(input())
  3.  
  4. collection_list = collection.split("|")
  5.  
  6. clothes_price = 50.00
  7. shoes_price = 35.00
  8. accessories_price = 20.50
  9. saved_sum = 0
  10. profit_sum = 0
  11.  
  12. list_buy = []
  13.  
  14. for x in collection_list:
  15.     purchase = x.split("->")
  16.     item = purchase[0]
  17.     price = float(purchase[1])
  18.  
  19.     if (item == "Clothes" and price <= clothes_price and price <= budget) or (item == "Shoes" and price <= shoes_price and price <= budget) or\
  20.             (item == "Accessories" and price <= shoes_price and price <= budget):
  21.         budget -= price
  22.         profit_price = round(price * 1.4, 2)
  23.         saved_sum += profit_price
  24.         list_buy.append(profit_price)
  25.         profit_sum += round((profit_price - price),2)
  26.     else:
  27.         continue
  28.  
  29. saved_sum = saved_sum + budget
  30.  
  31. for x in list_buy:
  32.     print(f"{x:.2f}", end=" ")
  33. print()
  34. print(f"Profit: {profit_sum:.2f}")
  35. if saved_sum >= 150:
  36.     print("Hello, France!")
  37. else:
  38.     print("Time to go.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement