I tried to write a nested function to calculate the area. However, the program showed the name circle is not defined.
Could anyone please help providing a suggestion about this nested function problem? What concept is missing from the below code?
def area(shape, n):
def circle(radius):
return 3.14*radius**2
def square(length):
return length*length
print(area(circle, 10) #system return -> name 'circle' is not defined
print(area(square, 5) #system return -> name 'square' is not defined
What concept is missing from the below code?- Binding of names, Resolution of names, Python Scopes and Namespaces.python functions in a class or module site:stackoverflow.comorpython function grouping site:stackoverflow.comor something similar.