def stoList(num):
for x in num:
return x
global n
n=0
def toFloat(x,y):
if(n == 0):
if(y!='.'):
return float(x)*10 +int(y)
else:
n = 1
n += 1
return x + int(y)/(10**(n-1))
r = map(stoList,s)
res = reduce(toFloat,r)
return res
Sign in to make a reply
新域街85号
def stoList(num):
for x in num:
return x
global n
n=0
def toFloat(x,y):
global n
if(n == 0):
if(y!='.'):
return float(x)*10 +int(y)
else:
n = 1
return x
else:
n += 1
return x + int(y)/(10**(n-1))
r = map(stoList,s)
res = reduce(toFloat,r)
return res