input: Write a function to implement bubble sort algorithm in Python for a given array. The function should sort the array in ascending order. If an empty array is provided, the function should return the empty array as is.
  assert bubble_sort([3,7,4,1])==[1,3,4,7]
  assert bubble_sort([5,3,8,4,6])==[3,4,5,6,8]
  assert bubble_sort([])==[]
  assert bubble_sort([1])==[1]
  assert bubble_sort([9,5,7,3,1])==[1,3,5,7,9]
output: def bubble_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