I'm writing code for find parameter and area of different 2D objects. I decide to use local functions for this or the code become deep nested code. when I run this code it's says "TypeError: unsupported operand type(s) for *: 'function' and 'function'"
#Area Of Rectangle Section
def rectanglearea(a, b):
length = a
width = b
#area = length * width
print ("")
print ("Formula = Length X Width")
#print ("Area Of This Rectangle Is: ", area)
#Length local function
def length (a):
length = input ("Input Length: ")
lengthLoop = 1
while lengthLoop == 1:
try :
length = float (length)
break
except:
print ("Invalid input please TRYT AGAIN !!")
continue
#Width local function
def width (a):
width = input ("Input Width: ")
widthLoop = 1
while widthLoop == 1:
try :
width = float(width)
break
except :
print ("Invalid input please TRY AGAIN !!!")
#Length
sampleValueForLength = 1
length (sampleValueForLength)
#Width
sampleValueForWidth = 1
width (sampleValueForWidth)
rectanglearea (length, width)
i tried like this :
#Area Of Rectangle Section
def rectanglearea(a, b):
length = a
width = b
**area = length (a) * width (a)**
print ("")
print ("Formula = Length X Width")
print ("Area Of This Rectangle Is: ", area)
lengthandwidth. Additionally you overwrite those functions with the valuesaandb.