This is a straightforward exercise in NumPy array slicing.
import numpy as np
def polygon_area(vertices):
"""
Return the area of the polygon enclosed by vertices using the shoelace
algorithm.
"""
a = np.vstack((vertices, vertices[0]))
S1 = sum(a[:-1,0] * a[1:,1])
S2 = sum(a[:-1,1] * a[1:,0])
return abs(S1-S2)/2
vertices = [(3,4), (5,11), (12,8), (9,5), (5,6)]
print(polygon_area(vertices))
For the example polygon the area is reported as 30.0
.