Iterate over all points other than the current point
for j in range ( len ( points ) ) : NEW_LINE INDENT if ( j == i ) : NEW_LINE INDENT continue NEW_LINE DEDENT dy = points [ i ] [ 1 ] - points [ j ] [ 1 ] NEW_LINE dx = points [ i ] [ 0 ] - points [ j ] [ 0 ] NEW_LINE DEDENT