Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/data/math
diff options
context:
space:
mode:
authorChris Ball <cjb@pullcord.laptop.org>2007-08-21 00:03:19 (GMT)
committer Chris Ball <cjb@pullcord.laptop.org>2007-08-21 00:03:19 (GMT)
commit534f8a13fae962056ae7ffe2cfb80ff40a36ca63 (patch)
treebd7a65688821970fbcae3ecd59dd9e0ba1dd2c66 /data/math
parent1bb3a0f7cc86a6ee693486dcf566f146ffb307f0 (diff)
Add a set of sample files.
Diffstat (limited to 'data/math')
-rw-r--r--data/math/apples15
-rw-r--r--data/math/pascal19
-rw-r--r--data/math/times12
-rw-r--r--data/math/times23
4 files changed, 39 insertions, 0 deletions
diff --git a/data/math/apples b/data/math/apples
new file mode 100644
index 0000000..ee726c7
--- /dev/null
+++ b/data/math/apples
@@ -0,0 +1,15 @@
+print "Let's do math!"
+
+print "On Monday I picked 22 apples. On Tuesday I picked 12."
+
+print "Now I have: ", 22 + 12
+
+print "My brother says he picked twice as many apples last week."
+
+print "This means he picked: ", (22 + 12) * 2
+
+print "I have 3 friends I would like to give apples."
+
+print "One third of my apples is about: ", (22 + 12) / 3
+
+print "Or, more exactly: ", (22.0 + 12.0) / 3.0
diff --git a/data/math/pascal b/data/math/pascal
new file mode 100644
index 0000000..4d600f4
--- /dev/null
+++ b/data/math/pascal
@@ -0,0 +1,19 @@
+# Pascal's triangle
+lines = 8
+
+vector = [1]
+
+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[:]
diff --git a/data/math/times1 b/data/math/times1
new file mode 100644
index 0000000..9355f1f
--- /dev/null
+++ b/data/math/times1
@@ -0,0 +1,2 @@
+for i in range(1,13):
+ print i, "x 4 =", (i*4)
diff --git a/data/math/times2 b/data/math/times2
new file mode 100644
index 0000000..b764ac0
--- /dev/null
+++ b/data/math/times2
@@ -0,0 +1,3 @@
+number = input("Which times table? ")
+for i in range(1,13):
+ print i, "x", number, "=", i*number