Advertisement
go6odn28

hello_france

Feb 15th, 2024
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. def increase_price(n):
  2.     result = n * 1.4
  3.     return result
  4.  
  5.  
  6. item_list = input().split("|")
  7. budget = float(input())
  8. enough_budget = False
  9.  
  10. new_price = 0
  11. list_of_prices = []
  12. for item in item_list:
  13.     valid_item = False
  14.     current_list = item.split("->")
  15.     current_item, price = current_list[0], float(current_list[1])
  16.     if price <= budget:
  17.         if current_item == "Clothes" and price <= 50.00:
  18.             valid_item = True
  19.         elif current_item == "Shoes" and price <= 35.00:
  20.             valid_item = True
  21.         elif current_item == "Accessories" and price <= 20.50:
  22.             valid_item = True
  23.         if valid_item:
  24.             list_of_prices.append(price)
  25.             budget -= price
  26.  
  27. increased_list = list(map(increase_price, list_of_prices))
  28. profit = sum(increased_list) - sum(list_of_prices)
  29.  
  30. if budget + sum(increased_list) >= 150:
  31.     enough_budget = True
  32.  
  33. print(" ".join(map(lambda x: f'{x:.2f}', increased_list)))
  34. print(f"Profit: {profit:.2f}")
  35.  
  36. if enough_budget:
  37.     print("Hello, France!")
  38. else:
  39.     print("Not enough money.")
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement