user
Implement a function to sort a list of strings according to their length.

listOfStrings = ["a", "long", "string", "verylongstring"]


assistant
def sortByLength(listOfStrings):
  return sorted(listOfStrings, key = len)