Case Studies
Inventory Alerts
Inventory logic flags records whose stock has reached a reorder threshold.
Inventory Alerts
inventory_alerts.py
items = [
{"sku": "pen", "stock": 8},
{"sku": "notebook", "stock": 3},
{"sku": "marker", "stock": 12},
]
reorder_level =
alerts = []
for item in items:
if item["stock"] <= reorder_level:
alerts.append(item["sku"])
print("alerts=" + ",".join(alerts))
items = [
{"sku": "pen", "stock": 8},
{"sku": "notebook", "stock": 3},
{"sku": "marker", "stock": 12},
]
reorder_level =
alerts = []
for item in items:
if item["stock"] <= reorder_level:
alerts.append(item["sku"])
print("alerts=" + ",".join(alerts))
threshold checks
A threshold check turns a numeric comparison into a small decision list.