Advertisement
GroZnik81

fast_food_python_advanced

Oct 28th, 2021
958
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. from collections import deque
  2.  
  3. quantity_food = int(input())
  4. orders_value = deque([int(x) for x in input().split()])
  5. max_order = max(orders_value)
  6. print(max_order)
  7. while orders_value:
  8.     current_order = orders_value.popleft()
  9.  
  10.     if quantity_food >= current_order:
  11.         quantity_food -= current_order
  12.     else:
  13.         orders_value.appendleft(current_order)
  14.         print(f"Orders left: {' '.join([str(x) for x in list(orders_value)])}")
  15.         break
  16. if not orders_value:
  17.     print("Orders complete")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement