Advertisement
Guest User

Untitled

a guest
Jan 21st, 2022
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 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' and price > 50.00:
  18.         continue
  19.  
  20.     if clothes == 'Shoes' and price > 35.00:
  21.         continue
  22.  
  23.     if clothes == 'Accessories' and price > 20.50:
  24.         continue
  25.            
  26.     budget -= price
  27.     total_bought.append(price * 1.40)
  28.     profit += price * 0.40
  29.  
  30. for ele in total_bought:
  31.     budget += ele
  32.  
  33.  
  34. def l_to_s(s):
  35.     str1 = ''
  36.     for element in s:
  37.         str1 += '{:.2f}'.format(element)
  38.         if element != s[-1]:
  39.             str1 += ' '
  40.     return str1
  41.  
  42.  
  43. print(l_to_s(total_bought))
  44. print(f'Profit: {profit:.2f}')
  45.  
  46. if budget >= 150.0:
  47.     print('Hello, France!')
  48. else:
  49.     print('Not enough money.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement