input: Write a function to sort an array using bubble sort.
  assert sort([64, 34, 25, 12, 22, 11, 90]) == [11, 12, 22, 25, 34, 64, 90]
  assert sort([5, 3, 8, 6, 7, 2]) == [2, 3, 5, 6, 7, 8]
  assert sort([20, 10, 30, 5, 40]) == [5, 10, 20, 30, 40]
output: def sort(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