编写一个程序，将给定的列表按照字符串长度进行排序。



words = ["apple", "banana", "orange", "pear"]

# TODO: Sort the words in the list by length
可以使用Python内置函数sorted()和一个lambda函数，实现按照字符串长度排序列表。代码如下：

```python
words = ["apple", "banana", "orange", "pear"]
words_sorted = sorted(words, key=lambda x: len(x))
print(words_sorted)
```

输出结果为：

```
['pear', 'apple', 'banana', 'orange']
```