Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/data/math/pascal
diff options
context:
space:
mode:
Diffstat (limited to 'data/math/pascal')
-rw-r--r--data/math/pascal27
1 files changed, 13 insertions, 14 deletions
diff --git a/data/math/pascal b/data/math/pascal
index 359acdd..06fab84 100644
--- a/data/math/pascal
+++ b/data/math/pascal
@@ -1,19 +1,18 @@
# Pascal's triangle
lines = 9
-
vector = [1]
-for i in range(1,lines+1):
- vector.insert(0,0)
- vector.append(0)
+for i in range(1, lines + 1):
+ vector.insert(0, 0)
+ vector.append(0)
-for i in range(0,lines):
- newvector = vector[:]
- for j in range(0,len(vector)-1):
- if (newvector[j] == 0):
- print " ",
- else:
- print "%2d" % newvector[j],
- newvector[j] = vector[j-1] + vector[j+1]
- print
- vector = newvector[:]
+for i in range(0, lines):
+ newvector = vector[:]
+ for j in range(0, len(vector) - 1):
+ if (newvector[j] == 0):
+ print ' ',
+ else:
+ print '%2d' % newvector[j],
+ newvector[j] = vector[j - 1] + vector[j + 1]
+ print
+ vector = newvector[:]