Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use iteration to output Yang Hui Triangle by python

Shulou Source: shulou.com Published: 2022-06-01 02:08:59 10月03日 Update

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

Tags: Yang Hui article iteration Yang Hui triangle triangle angle output value interest at the same time more friends last knowledge results editing industry information information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft Shulou Technology Docker NVidia