# 03. The Angry Cat

Feb 19th, 2024
905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. def cheap_summing(side, entry_point):
2.     return sum([x for x in side if x < entry_point])
3.
4. def expensive_summing(side, entry_point):
5.     return sum([x for x in side if x >= entry_point])
6.
7. def main():
8.     price_rating = [int(x) for x in input().split(", ")]
9.     entry_point = int(input())
10.     type_of_items = input()
11.
12.     left_side = price_rating[:entry_point]
13.     right_side = price_rating[entry_point + 1:]
14.     entry_point_value = price_rating[entry_point]
15.
16.     if type_of_items == "cheap":
17.         if cheap_summing(left_side, entry_point_value) >= cheap_summing(right_side, entry_point_value):
18.             print(f"Left - {cheap_summing(left_side, entry_point_value)}")
19.         else:
20.             print(f"Right - {cheap_summing(right_side, entry_point_value)}")
21.     elif type_of_items == "expensive":
22.         if expensive_summing(left_side, entry_point_value) >= expensive_summing(right_side, entry_point_value):
23.             print(f"Left - {expensive_summing(left_side, entry_point_value)}")
24.         else:
25.             print(f"Right - {expensive_summing(right_side, entry_point_value)}")
26.
27. if __name__ == "__main__":
28.     main()