user
Design an algorithm to reverse the elements of a given array.

[2, 4, 6, 8]


assistant
def reverse_array (array): 
  start = 0 
  end = len(array)-1
  while start<end: 
    temp = array[start] 
    array[start] = array[end] 
    array[end] = temp
    start += 1
    end = end-1
  return array