Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- items = input().split('|')
- budget = float(input())
- money = budget
- bought = []
- profit = 0
- '''
- макар начина на извличане на цената да е различен с долния код това не оказа влияние на резултата. Другите 2 неща посочени с коментари бяха разковничето да стане 0/100 до 100/100.
- '''
- for item in items:
- new_price = 0
- price = float(item[item.index('>') + 1:])
- if ('Clothes' in item and price <= 50) or ('Shoes' in item and price <= 35) or\
- ('Accessories' in item and price <= 20.50):
- if budget >= price:
- budget -= price
- new_price = price * 1.4
- bought.append(str(round(new_price, 2))) #тук е едната разлика с долния код
- profit += (new_price - price)
- money += profit
- print(' '.join(bought)) # тук е втората разлика с другия код.
- print(f'Profit: {profit:.2f}')
- if money >= 150:
- print('Hello, France!')
- else:
- print('Time to go.')
- #############################################################################################
- items = input().split('|')
- budget = float(input())
- new_budget = budget
- bought = []
- profit = 0
- for item in items:
- item = item.split('->')
- obj = item[0]
- price = float(item[1])
- new_price = 0
- if (obj == 'Clothes' and price <= 50) or (obj == 'Shoes' and price <= 35) or (obj == 'Accessories' and price <= 20.5):
- if budget >= price:
- budget -= price
- new_price = price * 1.4
- profit += new_price - price
- bought.append(f'{new_price:.2f}')
- new_budget += profit
- print(*bought)
- print(f'Profit: {profit:.2f}')
- if new_budget >= 150:
- print('Hello, France!')
- else:
- print('Time to go.')
Advertisement
Add Comment
Please, Sign In to add comment