Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- eggs = deque([int(x) for x in input().split(', ')])
- papers = [int(x) for x in input().split(', ')]
- boxes = 0
- while eggs and papers:
- egg = eggs.popleft()
- if egg < 0:
- continue
- if egg == 13:
- first_paper = papers[0]
- last_paper = papers[-1]
- papers.append(first_paper)
- papers.insert(0, last_paper)
- continue
- paper = papers.pop()
- total_sum = egg + paper
- if total_sum <= 50:
- boxes += 1
- else:
- continue
- if boxes >= 1:
- print(f"Great! You filled {boxes} boxes.")
- else:
- print(f"Sorry! You couldn't fill any boxes!")
- if eggs:
- print(f"Eggs left: {', '.join([str(x) for x in eggs])}")
- if papers:
- print(f"Pieces of paper left: {', '.join([str(x) for x in papers])}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement