Write a python program to sort a list of strings based on their lengths.
['test', 'sample', 'hello', 'world']
list_of_strings = ['test', 'sample', 'hello', 'world']

list_of_strings.sort(key=len)

print(list_of_strings)