Interchanging the colours
for i in range ( 1 , N + 1 ) : NEW_LINE INDENT if colour [ i ] == - 1 : NEW_LINE INDENT colour [ i ] = 1 NEW_LINE DEDENT else : NEW_LINE INDENT colour [ i ] = - 1 NEW_LINE DEDENT DEDENT