To learn about nested function, refer the following code. In the code, you can see Inner functions can access variables from the enclosing scope, which is the local variable.
def mulFunc(num1): def mul(num2): return num1 * num2 return mul res = mulFunc(15) // The following prints 300 i.e. 20*15 print(res(20))
The above prints the multiplication of num1 and num 2 i.e. 300