I apologize in advance. I am a beginner at coding.
I am trying to use Python to code a function to calculate the area of a polygon using 2 lists that contain the node locations using the following code:
def Area(xvalues, yvalues):
area = 0
stepone = 0
for x in xvalues:
for y in yvalues:
stepone = stepone + (xvalues(x)-xvalues(0))*(yvalues(y+1)-yvalues(y-1))
area = abs(stepone)/2
print area
xvalues = [2000, 2126, 2716, 2524, 2518, 2000]
yvalues = [1000, 1256, 1102, 408, 611, 1000]
Area(xvalues, yvalues)
However, I am getting an error that states "TypeError: 'list' object is not callable".
I just want the equation to cycle through the lists and return the final product. I am not sure where I am going wrong, but I think it may have something to do with my function parameters.
Any help would be greatly appreciated.
stepone = stepone + ...line will do? That's the problem line, you have parentheses where you should have brackets, but thex(0)is very confusing.