Advertisement
Guest User

Untitled

a guest
Jun 9th, 2021
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. items = input().split("|")
  2. budget1 = input()
  3. budget = float(budget1)
  4. max_clothes = 50.00
  5. max_shoes = 35.00
  6. max_accessories = 20.50
  7. profit = 0
  8. new_profit = 0
  9. new_price = []
  10. for elements in items:
  11.     if "Clothes" in elements:
  12.         el1 = elements.split('->')
  13.         val = float(el1[1])
  14.         if budget >= val and max_clothes >= val:
  15.             budget -= val
  16.             profit += val * 0.4
  17.             new_price.append(val * 1.4)
  18.             new_profit += val
  19.     elif "Shoes" in elements:
  20.         el1 = elements.split('->')
  21.         val = float(el1[1])
  22.         if budget >= val and max_shoes >= val:
  23.             budget -= val
  24.             profit += val * 0.4
  25.             new_price.append(val * 1.4)
  26.             new_profit += val
  27.     elif "Accessories" in elements:
  28.         el1 = elements.split('->')
  29.         val = float(el1[1])
  30.         if budget >= val and max_accessories >= val:
  31.             budget -= val
  32.             profit += val * 0.4
  33.             new_price.append(val * 1.4)
  34.             new_profit += val
  35.  
  36. for i in range(len(new_price)):
  37.     print(f"{(new_price[i]):.2f}", end=' ')
  38. print()
  39. print(f'Profit: {profit:.2f}')
  40. if ((new_profit) + budget + (new_profit * 0.4)) >= 150:
  41.     print("Hello, France!")
  42. else:
  43.     print("Time to go.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement