A(a, b) 排列:
reduce(lambda x, y: x*y, range(b-a+1,b+1))
C(a, b) 组合:
reduce(lambda x, y: x*y, range(b-a+1,b+1)) / reduce(lambda x, y: x*y, range(1,a+1))
一行实现打印杨辉三角
print '\n'.join([' '.join([str(reduce(lambda x,y:x*y,range(a-b+1,a+1) or [1])/reduce(lambda x,y:x*y,range(1,b+1) or [1])) for b in range(a+1)]) for a in range(15)])