Discuss / Python / 作业

作业

Topic source

wenyizhen

#1 Created at ... [Delete] [Delete and Lock User]

def str2float(s): arr = s.split('.') z = arr[0] x = arr[1] def fn(x, y): return x * 10 + y def char2num(s): return DIGITS[s] zs = reduce(fn, map(char2num, z)) xs = reduce(fn, map(char2num, x)) def mi(n): m = 1 while n > 0: m = 10 * m n -= 1 return m return zs + xs/mi(len(x))


  • 1

Reply