def counter(base): def inc(step=1): nonlocal base base = base + step return base return incfoo = counter(10)print(foo())