simeonshopov

Loot Box

Apr 30th, 2020
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. from collections import deque
  2.  
  3. loot_box_1 = deque(map(int, input().split()))
  4. loot_box_2 = deque(map(int, input().split()))
  5. items = []
  6.  
  7. while True:
  8.     if not loot_box_1:
  9.         break
  10.     if not loot_box_2:
  11.         break
  12.     portion_1 = loot_box_1[0]
  13.     portion_2 = loot_box_2[-1]
  14.     item = portion_1 + portion_2
  15.     if item % 2 == 0:
  16.         items.append(item)
  17.         loot_box_1.popleft()
  18.         loot_box_2.pop()
  19.     else:
  20.         to_move = loot_box_2.pop()
  21.         loot_box_1.append(to_move)
  22.  
  23. if not loot_box_1:
  24.     print('First lootbox is empty')
  25. else:
  26.     print('Second lootbox is empty')
  27. if items:
  28.     total = sum(items)
  29.     if total >= 100:
  30.         print(f'Your loot was epic! Value: {total}')
  31.     else:
  32.         print(f'Your loot was poor... Value: {total}')
Advertisement
Add Comment
Please, Sign In to add comment