Advertisement
Guest User

Untitled

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