From 984cdb849a4d10002f0001590a70fa8250c80089 Mon Sep 17 00:00:00 2001 From: holiu Date: Mon, 7 Feb 2022 13:31:36 +0800 Subject: [PATCH] Add Triangle.py to print Yanghui triangle --- Triangle.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Triangle.py diff --git a/Triangle.py b/Triangle.py new file mode 100644 index 0000000..efc7009 --- /dev/null +++ b/Triangle.py @@ -0,0 +1,24 @@ +""" +Print Yanghui Triangle +1 +11 +121 +1331 +1 4 6 4 1 +1 5 10 10 5 1 +""" + +def triangle(): + a=[1] + while(len(a)<7): + yield a + i=0 + while(i