def barska(n): res = [1] for i in range(n): print (‘ ‘*(n-i)), res.insert(0, 0) for j in range(len(res)-2): res[j] += res[j+1] print (‘%3d‘ %res[j]), res[len(res)-2] = 1 print (‘%3d‘ %res[len(res)-2]), print ‘‘
时间: 2024-11-25 20:15:33
def barska(n): res = [1] for i in range(n): print (‘ ‘*(n-i)), res.insert(0, 0) for j in range(len(res)-2): res[j] += res[j+1] print (‘%3d‘ %res[j]), res[len(res)-2] = 1 print (‘%3d‘ %res[len(res)-2]), print ‘‘