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