AI Agents by HandAll problemsAbout

All problems › Python drill · easy · ~5 min

d07 · Snapshot and look up orders

json parsing persistence

Solve it in your browser →

d07 · Snapshot and look up orders (~5 min)

Serialization. Edit drills.py. Standard library only; no model calls, no API key.

def save_orders(orders):

orders maps int order ids to order dicts. Return a JSON snapshot string.

def find_order(snapshot, order_id):

Look an order up in a snapshot from save_orders.

order_id arrives the way models send it: 1002, "1002", " 1002 ", "#1002" or full-width "1002". Return the order dict, or None if there's no such order or the id isn't a whole number.

Failure messages are enough to go on, so leave the tests unread until you submit.

Starter code and hidden tests open in the editor. Nothing to install.