input: Write a function to sort a list of strings by their length in ascending order. The function should take a list of strings as input and return the list sorted by the length of its elements. 
  
  def sort_by_length(strings):
      return sorted(strings, key=len)
  
  assert sort_by_length(["cat", "dog", "apple", "banana"]) == ["cat", "dog", "apple", "banana"]
  assert sort_by_length(["apple", "banana", "cat", "dog"]) == ["cat", "dog", "apple", "banana"]
  assert sort_by_length(["dragonfly", "ant", "butterfly", "fly"]) == ["ant", "fly", "fly", "dragonfly"]
  assert sort_by_length(["mouse", "horse", "elephant", "rabbit"]) == ["mouse", "horse", "rabbit", "elephant"]
  assert sort_by_length(["a", "zz", "bb", "ccc"]) == ["a", "zz", "bb", "ccc"]
  assert sort_by_length([]) == []
output: def sort_by_length(strings):
      return sorted(strings, key=len)