DiYane

Hello, France

Jul 31st, 2023 (edited)
1,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. collection_items = input()
  2. budget = float(input())
  3.  
  4. bought_products = []
  5. new_prices = []
  6.  
  7. for item in collection_items.split('|'):
  8.     tokens = item.split('->')
  9.     product_type = tokens[0]
  10.     product_price = float(tokens[1])
  11.     if product_type == "Clothes" and product_price > 50.00:
  12.         continue
  13.     if product_type == "Shoes" and product_price > 35.00:
  14.         continue
  15.     if product_type == "Accessories" and product_price > 20.50:
  16.         continue
  17.     if budget >= product_price:
  18.         budget -= product_price
  19.         bought_products.append(product_price)
  20.         new_prices.append(product_price * 1.4)
  21.  
  22. for new_price in new_prices:
  23.     print(f'{new_price:.2f}',end=' ')
  24. print('')
  25.  
  26. profit = sum(new_prices) - sum(bought_products)
  27. print(f'Profit: {profit:.2f}')
  28.  
  29. new_budget = budget + sum(new_prices)
  30. if new_budget >= 150:
  31.     print("Hello, France!")
  32. else:
  33.     print("Not enough money.")
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment