input: Write a function to sort a list of strings by their lengths in ascending order using a bubble sort algorithm. The function should return the sorted list.
  assert sort_by_length(["cat", "dog", "apple", "banana"]) == ["cat", "dog", "apple", "banana"]
  assert sort_by_length(["zebra", "fox", "panda", "tiger"]) == ["fox", "panda", "tiger", "zebra"]
  assert sort_by_length(["lion"]) == ["lion"]
  assert sort_by_length([]) == []
output: def sort_by_length(strings):
      n = len(strings)
      for i in range(n):
          for j in range(0, n-i-1):
              if len(strings[j]) > len(strings[j+1]):
                  strings[j], strings[j+1] = strings[j+1], strings[j]
      return strings