things = ["mozzaralla","cinderella","salmonella"]
def normalize(name):
return name[0].upper() + name[1:].lower()
def name_upper(name):
return name[:].upper()
def name_lower(name):
return name[:].lower()
Up_things = list(map(normalize,things))
print(Up_things)
b = Up_things.copy()
for i in range(len(things)):
b[i] = Up_things[len(things)-i-1]
print(b)
b = list(map(name_upper,b))
print(b)
b = list(map(name_lower,b))
print(b)
['Mozzaralla', 'Cinderella', 'Salmonella']
['Salmonella', 'Cinderella', 'Mozzaralla']
['SALMONELLA', 'CINDERELLA', 'MOZZARALLA']
['salmonella', 'cinderella', 'mozzaralla']
将列表倒置,首字母变大写,全部字母变大写,全部字母变小写
字典key(),values()互换
方法一: