aboutsummaryrefslogtreecommitdiff
path: root/challenge-209/roger-bell-west/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-209/roger-bell-west/python/ch-1.py')
-rwxr-xr-xchallenge-209/roger-bell-west/python/ch-1.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/challenge-209/roger-bell-west/python/ch-1.py b/challenge-209/roger-bell-west/python/ch-1.py
new file mode 100755
index 0000000000..4f3632b196
--- /dev/null
+++ b/challenge-209/roger-bell-west/python/ch-1.py
@@ -0,0 +1,22 @@
+#! /usr/bin/python3
+
+import unittest
+
+def specialbitcharacters(a):
+ s = 0
+ for v in a:
+ if s == 1:
+ s = 2
+ else:
+ s = v
+ return s == 0
+
+class TestSpecialbitcharacters(unittest.TestCase):
+
+ def test_ex1(self):
+ self.assertEqual(specialbitcharacters([1, 0, 0]), True, 'example 1')
+
+ def test_ex2(self):
+ self.assertEqual(specialbitcharacters([1, 1, 1, 0]), False, 'example 2')
+
+unittest.main()