aboutsummaryrefslogtreecommitdiff
path: root/challenge-145/roger-bell-west/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-145/roger-bell-west/python/ch-1.py')
-rwxr-xr-xchallenge-145/roger-bell-west/python/ch-1.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-145/roger-bell-west/python/ch-1.py b/challenge-145/roger-bell-west/python/ch-1.py
new file mode 100755
index 0000000000..83464b868f
--- /dev/null
+++ b/challenge-145/roger-bell-west/python/ch-1.py
@@ -0,0 +1,16 @@
+#! /usr/bin/python3
+
+import unittest
+
+def dotproduct(a,b):
+ p=0
+ for i,v in enumerate(a):
+ p+=v*b[i]
+ return p
+
+class TestDotproduct(unittest.TestCase):
+
+ def test_ex1(self):
+ self.assertEqual(dotproduct([1,2,3],[4,5,6]),32,'example 1')
+
+unittest.main()