Local variables are created when the function runs and destroyed when it ends:
def count():
counter = 0
counter += 1
return counter
print(count()) # 1
print(count()) # 1 (not 2!)
Each call creates a fresh counter. The previous call's counter is gone.
This is good. It means functions don't have hidden memory between calls. Each call starts fresh.