Advertisement
mbstanchev

angry cat

Jun 26th, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. price_raitings = list(map(int,input().split(', ')))
  2. entry_point = int(input())
  3. stat = input()
  4. left = []
  5. right = []
  6. to_compare = price_raitings[entry_point]
  7. for i in range(0, entry_point):
  8. if stat == 'cheap':
  9. if price_raitings[i] < to_compare:
  10. left.append(price_raitings[i])
  11. elif stat == 'expensive':
  12. if price_raitings[i] > to_compare:
  13. left.append(price_raitings[i])
  14.  
  15. for f in range(entry_point+1, len(price_raitings)):
  16. if stat == 'expensive':
  17. if price_raitings[f] > to_compare:
  18. right.append(price_raitings[f])
  19. elif stat == 'cheap':
  20. if price_raitings[f] < to_compare:
  21. right.append(price_raitings[f])
  22.  
  23. if sum(left) == sum(right):
  24. print(f'Left - {sum(left)}')
  25. else:
  26. if sum(left) > sum(right):
  27. print(f'Left - {sum(left)}')
  28. else:
  29. print(f'Right - {sum(right)}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement