公共和儿媳

Discuss / Python / note

thirty22

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

    n = map(lambda x:-1 if x=='.' else int(x), s)

    point = 0

    def prod(x,y):

        nonlocal point

        if y==-1:

            point=1

            return x

        elif point==0:

            return x*10+y

        else:

            point *=10

            return x+y/point

    return reduce(prod,n)


  • 1

Reply