Discuss / Python / map/reduce

map/reduce

Topic source

я

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

def str2float(s):

    def combine(x,y):

        while y>1:

            y = 0.1 * y

        return x + (abs(x)/x)*y

    def float2int(x):

        return int(x)

    # print(list(map(float2int, s.split('.'))))

    return reduce(combine, list(map(float2int, s.split('.'))))


  • 1

Reply