Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- household = list(map(int, input().split(", ")))
- entry_point = int(input())
- type = input()
- left = household[:entry_point]
- right = household[entry_point + 1:]
- sum_left = 0
- sum_right = 0
- entry_element = household[entry_point]
- if type == "cheap":
- sum_left = sum([n for n in left if n < entry_element])
- sum_right = sum([n for n in right if n < entry_element])
- elif type == "expensive":
- sum_left = sum([n for n in left if n >= entry_element])
- sum_right = sum([n for n in right if n >= entry_element])
- if sum_left >= sum_right:
- print(f"Left - {sum_left}")
- else:
- print(f"Right - {sum_right}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement