simeonshopov

Hello France

Jan 22nd, 2020
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. #!/usr/local/bin/python3.7
  2. # -*- coding: utf-8 -*import
  3.  
  4. items = input().split('|')
  5. budget = float(input())
  6. money = budget
  7. bought = []
  8. profit = 0
  9.  
  10. for item in items:
  11.     new_price = 0
  12.     price = float(item[item.index('>') + 1:])
  13.     if ('Clothes' in item and price <= 50) or ('Shoes' in item and price <= 35) or\
  14.             ('Accessories' in item and price <= 20.50):
  15.         if budget >= price:
  16.             budget -= price
  17.             new_price = price * 1.4
  18.             bought.append(f'{new_price:.2f}')
  19.             profit += (new_price - price)
  20.  
  21. money += profit
  22.  
  23. print(*bought)
  24.  
  25. print(f'Profit: {profit:.2f}')
  26.  
  27. if money >= 150:
  28.     print('Hello, France!')
  29. else:
  30.     print('Time to go.')
Advertisement
Add Comment
Please, Sign In to add comment