在下面的例子中,函数返回某个字符串的连续小写字母。
In the following example, a function returns the successive lowercase characters of a string.
下面这些函数都试图检查一个字符串是不是包含小写字母,但他们当中肯定有些是错的。
The following functions are all intended to check whether a string contains any lowercase letters, but at least some of them are wrong.
有时候建立一个列表需要遍历另一个列表。比如下面的这个函数就接收一个字符串列表,将所有字符串变为大写字母组成的,然后返回一个这些大写字符串组成的新列表。
Sometimes you want to traverse one list while building another. For example, the following function takes a list of strings and returns a new list that contains capitalized strings.
应用推荐