Python program to detect number of local variables defined in a program


Topic: Python program to detect number of local variables defined in a program

Solution

def abc():
    x = 1
    y = 2
    str1 = "w3resource"
    print("Python Exercises")
print(abc.__code__.co_nlocals)



List all Python Programs