6.1.3 Flow of Control & The Call Stack

Unit: Unit 6: Functions • Interactive Practice

Quick Answer & Summary:

Interactive Python programming tutorial and practice in your browser.

Interactive Challenge (Run Live in Browser):

# Trace flow of control through nested function execution
def step_three():
    print("  -> Step 3: Inside innermost helper")

def step_two():
    print(" -> Step 2: Entering middle function")
    step_three()
    print(" <- Step 2: Resuming after step_three returns")

def step_one():
    print("-> Step 1: Entering outer function")
    step_two()
    print("<- Step 1: Resuming after step_two returns")

print("Program Start")
step_one()
print("Program End")
Open in Live Interactive Python Sandbox →