input: Write a python function to sort an array using bubble sort algorithm.
  assert sort_array([5, 3, 8, 4, 2]) == [2, 3, 4, 5, 8]
  assert sort_array([20, 10, 30, 50, 40]) == [10, 20, 30, 40, 50]
  assert sort_array([1, 4, 3, 2]) == [1, 2, 3, 4]
  assert sort_array([8, 1, 7, 6, 5]) == [1, 5, 6, 7, 8]
output: def sort_array(arr):
      n = len(arr)
      for i in range(n):
          for j in range(0, n-i-1):
              if arr[j] > arr[j+1]:
                  arr[j], arr[j+1] = arr[j+1], arr[j]
      return arr