一、
def normalize(name): return name[0].upper()+name[1:].lower() 二、
def prod(L): return reduce(lambda x,y:xy,L) 三、 def char2num(s): DIGITS = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9} return DIGITS[s] o=[x for x in s if x!='.'] i=-1 while s[i]!='.': i-=1 return reduce(lambda x,y:x10+y,map(char2num,o))(10*(i+1))
Sign in to make a reply
DiDiDaDaDongDongDaDa梁经楚
一、
def normalize(name): return name[0].upper()+name[1:].lower() 二、
def prod(L): return reduce(lambda x,y:xy,L) 三、 def char2num(s): DIGITS = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9} return DIGITS[s] o=[x for x in s if x!='.'] i=-1 while s[i]!='.': i-=1 return reduce(lambda x,y:x10+y,map(char2num,o))(10*(i+1))