input: Write a function to sort a list of strings by their length. The function should return the sorted list.
  def sort_by_length(strings):
      for i in range(len(strings) - 1):
          for j in range(i + 1, len(strings)):
              if len(strings[i]) > len(strings[j]):
                  strings[i], strings[j] = strings[j], strings[i]
      return strings
  
  unsorted_list = ["cat", "dog", "apple", "banana"]
  
  sorted_list = sort_by_length(unsorted_list)
  
  print(sorted_list)
output: def sort_by_length(strings):
      return sorted(strings, key=len)