剑指offer python版 构建乘积数组

def aa(A):
    n=len(A)
    B=[1 for i in range(n)]
    for i in range(n):
        for j in range(n):
            if i !=j:
                B[i] *=A[j]
                
    return B

print(aa([1,2,3]))

 

posted @ 2018-10-29 16:51  findtruth123  阅读(211)  评论(0编辑  收藏  举报