def normalize(name):
first_name=name[0].upper
other_name=name[1:].lower
normalize_name=first_name+other_name
return normalize_name
L=['gsgds','sg','faf']
print(list(map(normalize,L)))
你这个函数其实有现成的,str.title()就是实现首字母大写,其它小写的功能
L=['gsgds','sg','faf']
print(list(map(lambda x:x.title(),L)))
def normalize(name):
first_name=name[0].upper()
other_name=name[1:].lower()
normalize_name=first_name+other_name
return normalize_name
L=['gsgds','sg','faf']
print(list(map(normalize,L)))
漏了两个(),如果对你有帮助,帮忙采纳下