def normalize(name):
return name.title()
def prod(L):
def multi(x,y):
return x*y
return reduce(multi,L)
def str2float(s):
a=s.index('.')
b=s.replace('.','')
DIGITS = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}
def f(x,y):
return 10*x+y
def char2float(b):
return DIGITS[b]
return reduce(f,map(char2float,b))/(10**a)
Sign in to make a reply
柴哲远
def normalize(name):
return name.title()
def prod(L):
def multi(x,y):
return x*y
return reduce(multi,L)
def str2float(s):
a=s.index('.')
b=s.replace('.','')
DIGITS = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}
def f(x,y):
return 10*x+y
def char2float(b):
return DIGITS[b]
return reduce(f,map(char2float,b))/(10**a)