Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. # Theme_2.12, 09. * Hello, France
  2.  
  3. items_list = input().split('|') # items with their prices – real numbers in the range [0.00……1000.00]
  4. # print(f'items_list: {items_list}')
  5. budget = float(input()) # budget – a real number in the range [0.0….1000.0]
  6. buying_list = []
  7.  
  8. for i in range(len(items_list)):
  9. element = items_list[i].split('->')
  10. # print(f'Element: {element}')
  11. item_price = float(element[1])
  12. if element[0] == 'Clothes' and 0 < item_price <= 50.00:
  13. if budget >= item_price:
  14. buying_list.append(item_price)
  15. # print(f'buying_list: {buying_list}')
  16. budget -= item_price
  17. # print(f'budget = {budget}')
  18. else:
  19. continue
  20. elif element[0] == 'Shoes' and 0 < item_price <= 35.00:
  21. if budget >= item_price:
  22. buying_list.append(item_price)
  23. # print(f'buying_list: {buying_list}')
  24. budget -= item_price
  25. # print(f'budget = {budget}')
  26. else:
  27. continue
  28. elif element[0] == 'Accessories' and 0 < item_price <= 20.50:
  29. if budget >= item_price:
  30. buying_list.append(item_price)
  31. # print(f'buying_list: {buying_list}')
  32. budget -= item_price
  33. # print(f'budget = {budget}')
  34. else:
  35. continue
  36.  
  37. # print(f'budget = {budget}')
  38. selling_list = [round(i * 1.4, 2) for i in buying_list]
  39. # print(f'buying_list: {buying_list}')
  40. # print(f'selling_list: {selling_list}')
  41. selling_str = " ".join(map(str, selling_list))
  42. print(selling_str)
  43. profit = round(sum(selling_list) - sum(buying_list), 2)
  44. print(f'Profit: {profit}')
  45. new_budget = budget + sum(selling_list)
  46. # print(f'New budget = {new_budget}')
  47. if new_budget >= 150.00:
  48. print('Hello, France!')
  49. else:
  50. print('Time to go.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement