Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cheap_summing(side, entry_point):
- return sum([x for x in side if x < entry_point])
- def expensive_summing(side, entry_point):
- return sum([x for x in side if x >= entry_point])
- def main():
- price_rating = [int(x) for x in input().split(", ")]
- entry_point = int(input())
- type_of_items = input()
- left_side = price_rating[:entry_point]
- right_side = price_rating[entry_point + 1:]
- entry_point_value = price_rating[entry_point]
- if type_of_items == "cheap":
- if cheap_summing(left_side, entry_point_value) >= cheap_summing(right_side, entry_point_value):
- print(f"Left - {cheap_summing(left_side, entry_point_value)}")
- else:
- print(f"Right - {cheap_summing(right_side, entry_point_value)}")
- elif type_of_items == "expensive":
- if expensive_summing(left_side, entry_point_value) >= expensive_summing(right_side, entry_point_value):
- print(f"Left - {expensive_summing(left_side, entry_point_value)}")
- else:
- print(f"Right - {expensive_summing(right_side, entry_point_value)}")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement