第一题
def normalize(name): return name.capitalize()
第二题
def prod(L): def s(x,y): return x*y return reduce(s,L)
第三题
digits = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9} def char2num(c): return DIGITS[c] def fn(x, y): return x * 10 + y intNum, floatNum = s.split('.') intNum = reduce(fn, map(char2num, intNum)) floatNum = 10**(-len(floatNum)) * reduce(fn, map(char2num, floatNum)) return intNum + floatNum
Sign in to make a reply
Vincent_胡小金
第一题
第二题
第三题