Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- bees = deque(map(int, input().split()))
- nectar = list(map(int, input().split()))
- symbols = input().split()
- symbols = symbols[::-1]
- operations = {
- "*": lambda b, n: b * n,
- "/": lambda b, n: b / n,
- "-": lambda b, n: b - n,
- "+": lambda b, n: b + n
- }
- totalhoney = 0
- honey = 0
- while bees and nectar:
- bee = bees.popleft()
- nect = nectar.pop()
- if bee > nect:
- bees.appendleft(bee)
- elif nect >= bee:
- symbol = symbols.pop()
- if nect == 0 and symbol == "/":
- continue
- honey = operations[symbol](bee, nect)
- totalhoney += abs(honey)
- print("Total honey made:", totalhoney)
- if bees: print(f"Bees left: {', '.join([str(x) for x in bees])}")
- if nectar: print(f"Nectar left: {', '.join([str(x) for x in nectar])}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement