Develop a program to sort an list of strings by their length using Python.
['dog', 'cat', 'mouse', 'elephant']
def sort_by_length(strings): 
    return sorted(strings, key=len) 
  
# Test 
strings = ['dog', 'cat', 'mouse', 'elephant'] 
  
print(sort_by_length(strings))