目录
16. 查找字符串中的最大字符
s = "helloworld"
print(max(s))
17. 删除字符串中的所有元音
def remove_vowels(s):
vowels = "aeiouAEIOU"
return ''.join([char for char in s if char not in vowels])
print(remove_vowels("hello world"))
18. 计算列表中的元素之和
lst = [1, 2, 3, 4, 5]
print(sum(lst))
19. 找到列表中的最大和最小元素
lst = [1, 2, 3, 4, 5]
print(max(lst), min(lst))
20. 计算列表的平均值
lst = [1, 2, 3, 4, 5]
print(sum(lst) / len(lst))