input: Write a python function to sort a list of strings by their lengths.
  assert sort_by_length(["apple", "banana", "cherry", "date"]) == ["date", "apple", "banana", "cherry"]
  assert sort_by_length(["short", "tiny", "medium", "lengthy"]) == ["tiny", "short", "medium", "lengthy"]
  assert sort_by_length(["a", "abc", "ab"]) == ["a", "ab", "abc"]
output: def sort_by_length(strings):
      return sorted(strings, key=len)