A placeholder is a tiny temporary function that stands in for unfinished functionality. It lets you build and test the program’s overall flow before writing every detail. section 6.0
Imagine assembling a café’s main menu. The menu can call get_order(), print_order(), and save_order() even before those functions are ready. Each placeholder can simply print a message or return an empty order. Once the menu works, replace the stand-ins with real code. section 6.0
A useful placeholder workflow is:
- Sketch the large program flow and decide which functions it needs. section 6.0
- Create simple functions with the expected names and basic outputs. section 6.0
- Run the main menu, check that calls and loops behave correctly, then replace each placeholder. section 6.0
YOUR TURN
Create a main_menu() function with a while loop. Let it call placeholder functions for getting, printing, and saving an order; then personalize one function with real behavior. section 6.0
Listing 6.1 A main menu with simple functions
def main_menu():
while True:
order = get_order()
print("Check your order:")
print_order(order)
confirm = input("Confirm? Press Y to confirm, N to cancel: ")
if confirm == "Y" or confirm == "y":
save_order(order)
print("Thanks for your order:")
print_order(order)
else:
continue
def get_order():
return {}
def print_order(order):
print(order)
return
def save_order(order):
print("Saving order...")
return
main_menu()
Inspect a complete main menu whose small functions are still placeholders. section 6.0






