Checking whether the last point is local maxima or minima or neither
if ( arr [ - 1 ] > arr [ - 2 ] ) : NEW_LINE INDENT mx . append ( n - 1 ) NEW_LINE DEDENT elif ( arr [ - 1 ] < arr [ - 2 ] ) : NEW_LINE INDENT mn . append ( n - 1 ) NEW_LINE DEDENT