Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Theme_2.12, 09. * Hello, France
- items_list = input().split('|') # items with their prices – real numbers in the range [0.00……1000.00]
- # print(f'items_list: {items_list}')
- budget = float(input()) # budget – a real number in the range [0.0….1000.0]
- buying_list = []
- for i in range(len(items_list)):
- element = items_list[i].split('->')
- # print(f'Element: {element}')
- item_price = float(element[1])
- if element[0] == 'Clothes' and 0 < item_price <= 50.00:
- if budget >= item_price:
- buying_list.append(item_price)
- # print(f'buying_list: {buying_list}')
- budget -= item_price
- # print(f'budget = {budget}')
- else:
- continue
- elif element[0] == 'Shoes' and 0 < item_price <= 35.00:
- if budget >= item_price:
- buying_list.append(item_price)
- # print(f'buying_list: {buying_list}')
- budget -= item_price
- # print(f'budget = {budget}')
- else:
- continue
- elif element[0] == 'Accessories' and 0 < item_price <= 20.50:
- if budget >= item_price:
- buying_list.append(item_price)
- # print(f'buying_list: {buying_list}')
- budget -= item_price
- # print(f'budget = {budget}')
- else:
- continue
- # print(f'budget = {budget}')
- selling_list = [round(i * 1.4, 2) for i in buying_list]
- # print(f'buying_list: {buying_list}')
- # print(f'selling_list: {selling_list}')
- selling_str = " ".join(map(str, selling_list))
- print(selling_str)
- profit = round(sum(selling_list) - sum(buying_list), 2)
- print(f'Profit: {profit}')
- new_budget = budget + sum(selling_list)
- # print(f'New budget = {new_budget}')
- if new_budget >= 150.00:
- print('Hello, France!')
- else:
- print('Time to go.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement