input: Write a function to sort an array of strings by their length in ascending order. The function should take a list of strings as input and return the sorted list. If the input list is empty, the function should return an empty list.
  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(["a", "ab", "abc", "abcd"]) == ["a", "ab", "abc", "abcd"]
  assert sort_by_length(["longstring", "short", "medium"]) == ["short", "medium", "longstring"]
  assert sort_by_length([]) == []
output: def sort_by_length(strings):
      return sorted(strings, key=len)