 # Retake Exam - 14 April 2021 (problem1)

Jun 10th, 2021
427
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. from collections import deque
2.
3. tasks = deque()
4.
5. for order in input().split(", "):
6.     if int(order) <= 10:
7.         tasks.append(int(order))
8.
9. total_orders = sum(tasks)
10. workers_capacity = [int(el) for el in input().split(", ")]
11.
12. for order in tasks:
13.     to_do = tasks.popleft()
14.     worker = workers_capacity.pop()
15.     if worker >= to_do:
16.         workers_capacity.pop()
17.     else:
18.         ad_order = to_do - worker
19.         tasks.append(ad_order)
20.     if len(workers_capacity) == 0:
21.         break
22.     if len(tasks) == 0:
23.         break
24.
25. if len(tasks) == 0:
26.     print("All orders are successfully completed!")
27.     print(f"Total pizzas made: {total_orders}")
28.     print(f"Employees: {', '.join([str(el) for el in workers_capacity])}")
29.
30. if len(workers_capacity) == 0:
31.     print(f"Not all orders are completed.")
32.     print(f"Orders left: {', '.join([str(el) for el in tasks])}")
RAW Paste Data