Discuss / Python / 交作业(笨办法)

交作业(笨办法)

Topic source

roc风羿

#1 Created at ... [Delete] [Delete and Lock User]
    def fact(n):
        if n == 0:
            return 1
        if n == 1:
            return 1
        return n*fact(n - 1)
    m = 1
    while True:
        g = [fact(m - 1)//(fact(i)*fact(m - i - 1)) for i in range(m)]
        yield g
        m = m + 1

roc风羿

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

上面显示有问题

    def fact(n):
        if n == 0:
            return 1
        if n == 1:
            return 1
        return n*fact(n - 1)
    m = 1
    while True:
        g = [fact(m - 1)//(fact(i)*fact(m - i - 1)) for i in range(m)]
        yield g
        m = m + 1

  • 1

Reply