Discuss / Python / 练习

练习

Topic source

def createCounter():

    def count():

        n = 0

        while True:

            n += 1

            yield n

    c = count()

    def counter():

        return next(c)

    return counter


  • 1

Reply