Advertisement
Guest User

Untitled

a guest
Jan 21st, 2022
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1. items = input().split("|")
  2. budget = float(input())
  3. total_bought = []
  4. profit = 0
  5.  
  6. for item in items:
  7.     indx = item.split('->')
  8.     clothes = indx[0]
  9.     price = float(indx[1])
  10.  
  11.     is_accepted = False
  12.  
  13.     if price > budget:
  14.         continue
  15.  
  16.     if clothes == 'Clothes':
  17.         if price <= 50.00:
  18.             budget -= price
  19.             is_accepted = True
  20.     elif clothes == 'Shoes':
  21.         if price <= 35.00:
  22.             budget -= price
  23.             is_accepted = True
  24.     elif clothes == 'Accessories':
  25.         if price <= 20.50:
  26.             budget -= price
  27.             is_accepted = True
  28.     if is_accepted:
  29.         res = float("{:.2f}".format(price * 1.40))
  30.         total_bought.append(price * 1.40)
  31.         profit += (price * 1.40) - price
  32.  
  33. for ele in total_bought:
  34.     budget += ele
  35.  
  36.  
  37. def l_to_s(s):
  38.     str1 = ''
  39.     for element in s:
  40.         str1 += "{:.2f}".format(element) + " "
  41.     return str1
  42.  
  43.  
  44. print(l_to_s(total_bought))
  45. print(f'Profit: {profit:.2f}')
  46.  
  47. if budget >= 150:
  48.     print('Hello, France!')
  49. else:
  50.     print('Not enough money.')
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement