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