编写一个函数,交换指定字典的key和value。 例如:dict1={‘a’:1, ‘b’:2, ‘c’:3} --> dict1={1:‘a’, 2:‘b’, 3:‘c’} def change{‘key1’:value1}: def exchange(dict1): x = [] y = [] z = [] for i in dict1: x.append(dict1[i]) y.append(i) for a in range(len(x)): z.append([x[a],y[a]]) dict2 = dict(z) print(dict2) exchange({'a':1, 'b':2, 'c':3}) 编写一个函数,提取指定字符串中所有的字母,然后拼接在一起产生一个新的字符串 例如: 传入’12a&bc12d-+’ --> ‘abcd’ def letter(str1): new_str1 = '' for x in str1: if 'a' <= x <= 'z': new_str1 += x print(new_str1) letter('sdfs231j3ds') 写一个自己的capitalize函数,能够将指定字符串的首字母变成大写字母 例如: ‘abc’ -> ‘Abc’ ‘12asd’ --> ‘12asd’ def capitaliaze(str1