GroZnik81

Pizzaaa

Apr 14th, 2021
420
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 current_order > 10 or current_order <= 0:
  13.         pizza_orders.popleft()
  14.     elif current_order > current_maker:
  15.          left_order = current_order - current_maker
  16.          current_order = left_order
  17.          pizza_orders.extend(left_order)
  18.          employees_make_pizza.pop()
  19.  
  20.     elif current_order <= current_maker:
  21.         pizza_orders.popleft()
  22.         employees_make_pizza.pop()
  23.         orders_are_completed += current_order
  24.         if current_order > current_maker:
  25.             left_order = current_order - current_maker
  26.             current_order += left_order
  27.  
  28.  
  29. if len(employees_make_pizza) > 0:
  30.     print(f"All orders are successfully completed!")
  31.     print(f"Total pizzas made: {orders_are_completed}")
  32.     print(f"Employees: {(', '.join(str(lc) for lc in employees_make_pizza))}")
  33. else:
  34.     print(f"Not all orders are completed.")
  35.     print(f"Orders left: {(', '.join(str(lc)for lc in left_order))}")
RAW Paste Data