Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- bees = deque([int(n) for n in input().split()])
- nectar_stack = [int(n) for n in input().split()]
- symbols = deque(input().split())
- honey = 0
- while bees and nectar_stack:
- current_nectar = nectar_stack.pop()
- if current_nectar < bees[0]:
- continue
- else:
- math_sign = symbols.popleft()
- current_bee = bees.popleft()
- if math_sign == "+":
- honey += abs(current_nectar + current_bee)
- elif math_sign == "-":
- honey += abs(current_bee - current_nectar)
- elif math_sign == "*":
- honey += abs(current_nectar * current_bee)
- elif math_sign == "/" and current_nectar > 0:
- honey += abs(current_bee / current_nectar)
- print(f"Total honey made: {honey}")
- if bees:
- print(f"Bees left: {', '.join(str(n) for n in bees)}")
- if nectar_stack:
- print(f"Nectar left: {', '.join(str(n) for n in nectar_stack)}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement