How to use iteration to output Yang Hui Triangle by python
This article mainly introduces how to use python iterative output Yang Hui triangle, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Iteration
Def triangle_1 (x): "": param x: number of Yang Hui triangle rows to be generated: return: "" triangle = [[1], [1,1]] # initialize Yang Hui triangle n = 3 # count from the third line and add while n line by line