Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- loot_box_1 = deque(map(int, input().split()))
- loot_box_2 = deque(map(int, input().split()))
- items = []
- while True:
- if not loot_box_1:
- break
- if not loot_box_2:
- break
- portion_1 = loot_box_1[0]
- portion_2 = loot_box_2[-1]
- item = portion_1 + portion_2
- if item % 2 == 0:
- items.append(item)
- loot_box_1.popleft()
- loot_box_2.pop()
- else:
- to_move = loot_box_2.pop()
- loot_box_1.append(to_move)
- if not loot_box_1:
- print('First lootbox is empty')
- else:
- print('Second lootbox is empty')
- if items:
- total = sum(items)
- if total >= 100:
- print(f'Your loot was epic! Value: {total}')
- else:
- print(f'Your loot was poor... Value: {total}')
Advertisement
Add Comment
Please, Sign In to add comment