Python3 implementation of the above approach
def printArray ( array , length ) : NEW_LINE INDENT print ( " [ " , end = " " ) NEW_LINE for i in range ( length ) : NEW_LINE INDENT print ( array [ i ] , end = " " ) if ( i < ( length - 1 ) ) : print ( " , " , end = " ▁ " ) else : print ( " ] " ) NEW_LINE DEDENT DEDENT def reverse ( array , start , end ) : NEW_LINE INDENT while ( start < end ) : NEW_LINE INDENT temp = array [ start ] NEW_LINE array [ start ] = array [ end ] NEW_LINE array [ end ] = temp NEW_LINE start += 1 NEW_LINE end -= 1 NEW_LINE DEDENT DEDENT