Calculate the centroid
x = 0 NEW_LINE y = 0 NEW_LINE for i in range ( len ( p ) ) : NEW_LINE INDENT x += p [ i ] [ 0 ] NEW_LINE y += p [ i ] [ 1 ] NEW_LINE DEDENT x = x // len ( p ) NEW_LINE y = y // len ( p ) NEW_LINE