#第一题 def normalize(name): return str.title(name) #第二题 def prod(L): def multiply(x,y): return x*y return reduce(multiply,L) #第三题 def fn(x, y): return x * 10 + y 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] def str2float(s): L = s.split(sep='.') return reduce(fn, map(char2num, L[0]))+reduce(fn,map(char2num,L[1]))/(10**(len(s)-s.index('.')-1))
Sign in to make a reply
babeCoral珊