Python Tutorial: Nested function & nonlocal keyword in Python

Опубликовано: 22 October 2024
на канале: Learn to code
204
2

Nested function & nonlocal keyword in Python.
A function defined inside another function is called a nested function. Nested functions can access variables of the enclosing scope.

In Python, these non-local variables are read-only by default and we must declare them explicitly as non-local (using nonlocal keyword) in order to modify them.

#Python for beginners :    • Python Programming