input: Write a function to sort a list of strings by their lengths.
  assert sort_by_length(["apple", "fig", "banana", "date"]) == ["fig", "date", "apple", "banana"]
  assert sort_by_length(["a", "ab", "abc", "abcd"]) == ["a", "ab", "abc", "abcd"]
  assert sort_by_length(["lion", "cat", "hippopotamus", "elephant"]) == ["cat", "lion", "elephant", "hippopotamus"]
output: def sort_by_length(strings):
      return sorted(strings, key=len)