viligen

angry_cat

Oct 25th, 2021
639
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. household = list(map(int, input().split(", ")))
  2. entry_point = int(input())
  3. type = input()
  4.  
  5. left = household[:entry_point]
  6. right = household[entry_point + 1:]
  7. sum_left = 0
  8. sum_right = 0
  9. entry_element = household[entry_point]
  10. if type == "cheap":
  11.     sum_left = sum([n for n in left if n < entry_element])
  12.     sum_right = sum([n for n in right if n < entry_element])
  13.  
  14. elif type == "expensive":
  15.     sum_left = sum([n for n in left if n >= entry_element])
  16.     sum_right = sum([n for n in right if n >= entry_element])
  17.  
  18. if sum_left >= sum_right:
  19.     print(f"Left - {sum_left}")
  20. else:
  21.     print(f"Right - {sum_right}")
  22.  
RAW Paste Data