GroZnik81

pizza

Apr 14th, 2021
364
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from collections import deque
  2.  
  3. pizza_orders = deque(int(pizza_ord) for pizza_ord in input().split(", "))
  4. employees_make_pizza = list(int(pizza_maker) for pizza_maker in input().split(", "))
  5.  
  6. orders_are_completed = 0
  7.  
  8. while pizza_orders and employees_make_pizza:
  9.     current_order = pizza_orders[0]
  10.     current_maker = employees_make_pizza[-1]
  11.  
  12.     if 0 >= current_order < 10:
  13.         pizza_orders.popleft()
  14.     elif current_order <= current_maker:
  15.         pizza_orders.popleft()
  16.         employees_make_pizza.pop()
  17.         orders_are_completed += current_order
  18.     elif current_order > current_maker:
  19.         left_order = current_order - current_maker
  20.         current_order += left_order
  21. if len(employees_make_pizza) > 0:
  22.     print(f"All orders are successfully completed!")
  23.     print(f"Total pizzas made: {orders_are_completed}")
  24.     print(f"Employees: {(', '.join(str(lc) for lc in employees_make_pizza))}")
  25. else:
  26.     print(f"Not all orders are completed")
  27.     print(f"Orders left: {(', '.join(str(lc)for lc in employees_make_pizza))}")
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×