Python Execution Visual Guide
This visual guide explains key Python behaviors using simple diagrams: append vs list
concatenation, default mutable arguments, function call references, and nested loop execution
patterns.
1. append() vs + operator
append() mutates existing list
['a'] append('b') → ['a','b']
+ creates a new list
['a'] ['a'] + ['b'] → ['a','b']
2. Default Mutable Argument Behavior
Default List Shared Across Calls
[] [1] [1,1]
function default after call 1 after call 2
3. Function Parameter Reference Model
Function Reference Passing
a lst [1,5]
caller variable function parameter same list object
4. Nested Loop Execution Grid
Outer x Inner y Result append
1 1 1+1=2
1 2 1+2=3
2 1 2+1=3
2 2 2+2=4
Key Rules:
1. append() modifies the same list object.
2. list + [item] creates a new list.
3. Default mutable arguments persist between function calls.
4. Nested loops execute inner loops completely for each outer iteration.