Write a Python program to access a function inside a function


Introduction

Write a Python program to access a function inside a function. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. def test(a):
  2. def add(b):
  3. nonlocal a
  4. a += 1
  5. return a+b
  6. return add
  7. func= test(10)
  8. print(func(10))

Result

python language techstudy.org

     





Related Topics




Popular Posts