In | Function to reverse arr [ ] from start to end ; Create a copy array and store reversed elements ; Now copy reversed elements back to arr [ ] ; Driver code
def revereseArray ( arr , n ) : NEW_LINE INDENT rev = n * [ 0 ] NEW_LINE for i in range ( 0 , n ) : NEW_LINE INDENT rev [ n - i - 1 ] = arr [ i ] NEW_LINE DEDENT for i in range ( 0 , n ) : NEW_LINE INDENT arr [ i ] = rev [ i ] NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT arr = [ 1 , 2 , 3 , 4 , 5 , 6 ] NEW_LINE n = len ( arr ) NEW_LINE print ( * arr ) NEW_LINE revereseArray ( arr , n ) ; NEW_LINE print ( " Reversed ▁ array ▁ is " ) NEW_LINE print ( * arr ) NEW_LINE DEDENT