Sichanov

angry_cat

Oct 26th, 2021
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. price_ratings = [int(i) for i in input().split(', ')]
  2. entry_point = int(input())
  3. type_items = input()
  4.  
  5. if type_items == 'cheap':
  6.     left = [i for i in price_ratings[:entry_point] if i < price_ratings[entry_point]]
  7.     right = [i for i in price_ratings[entry_point + 1:] if i < price_ratings[entry_point]]
  8. else:
  9.     left = [i for i in price_ratings[:entry_point] if i >= price_ratings[entry_point]]
  10.     right = [i for i in price_ratings[entry_point + 1:] if i >= price_ratings[entry_point]]
  11.  
  12. if sum(left) >= sum(right):
  13.     print(f'Left - {sum(left)}')
  14. else:
  15.     print(f'Right - {sum(right)}')
Advertisement
Add Comment
Please, Sign In to add comment