high = s.split('.')[0] lower = s.split('.')[1] def f(x,y):
return x * 10 + y
result = reduce(f,map(int,high)) + reduce(f,map(int,lower))/1000 return result
2. def prod(L): def f(x1,x2):
return x1 * x2
return reduce(f,L)
result = reduce(f,map(int,high)) + reduce(f,map(int,lower))/1000 这句除1000是有缺陷的
Sign in to make a reply
Gday小海狮
high = s.split('.')[0] lower = s.split('.')[1] def f(x,y):
result = reduce(f,map(int,high)) + reduce(f,map(int,lower))/1000 return result
2. def prod(L): def f(x1,x2):
return reduce(f,L)