-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathLists.py
More file actions
26 lines (20 loc) · 745 Bytes
/
Copy pathLists.py
File metadata and controls
26 lines (20 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# restaurant_queue.py
from typing import List
def process_orders() -> None:
orders: List[str] = []
# Simulate incoming orders
orders.append("Veggie Burger")
orders.append("Caesar Salad")
orders.insert(0, "VIP Table: Truffle Pasta") # O(n) shift
# Modify an order
orders[1] = "Caesar Salad (No Croutons)"
# Remove completed order if it exists
if "Veggie Burger" in orders:
orders.remove("Veggie Burger") # O(n) search + O(n) shift
else:
print("⚠️ Warning: Veggie Burger order not found to remove")
# Slice: next 2 orders for kitchen dispatch
next_batch = orders[:2]
print("📤 Dispatch:", next_batch)
if __name__ == "__main__":
process_orders()