Values & References13 / 18
Up next

Rebinding a parameter is local

def replace(items):
    # rebinding the local name breaks the link to the caller
    items = [9, 9, 9]
    return items


nums = [1, 2, 3]
result = replace(nums)
print(nums)
print(result)
What you're solving

reassigning a name inside does not reach the caller