Data storage keeps an application’s information available beyond its current run. In the order program, confirmed orders are stored in an orders.json file, turning a menu script into a useful real application. section 9.1 section 9.0
A simple file-storage pattern:
- Check whether the storage file exists with os.path.exists(). section 9.1
- Load existing orders from JSON, or begin with an empty list when the file is missing. section 9.0
- Append each confirmed order and save the complete list back to the file. section 9.0
An order survives the program
After an order from Jason is entered, the program saves it in orders.json. Opening the file reveals the recent order alongside earlier orders. section 9.0
orders = load_orders("orders.json")
main_menu(orders)
save_orders(orders, "orders.json")
See the compact integration point: load orders before the menu, then save them after the menu finishes. section 9.0

