aboutsummaryrefslogtreecommitdiff
path: root/challenge-090/roger-bell-west/python
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-12-07 21:48:26 +0000
committerGitHub <noreply@github.com>2020-12-07 21:48:26 +0000
commit2bfbf295586eac9e82a1c2f42cffa5cd8e61d33a (patch)
tree7cb082a7f63b8efc033f59ddf9ef8f866fe1d4e0 /challenge-090/roger-bell-west/python
parent2009bf53c9e1006b876bc0c6bdc23d285386e168 (diff)
parentef909ced247550a2283c870a576f947f207e3125 (diff)
downloadperlweeklychallenge-club-2bfbf295586eac9e82a1c2f42cffa5cd8e61d33a.tar.gz
perlweeklychallenge-club-2bfbf295586eac9e82a1c2f42cffa5cd8e61d33a.tar.bz2
perlweeklychallenge-club-2bfbf295586eac9e82a1c2f42cffa5cd8e61d33a.zip
Merge pull request #2943 from Firedrake/rogerbw-challenge-090
Solutions for challenge #90.
Diffstat (limited to 'challenge-090/roger-bell-west/python')
-rwxr-xr-xchallenge-090/roger-bell-west/python/ch-1.py15
-rwxr-xr-xchallenge-090/roger-bell-west/python/ch-2.py22
2 files changed, 37 insertions, 0 deletions
diff --git a/challenge-090/roger-bell-west/python/ch-1.py b/challenge-090/roger-bell-west/python/ch-1.py
new file mode 100755
index 0000000000..64ac9905d0
--- /dev/null
+++ b/challenge-090/roger-bell-west/python/ch-1.py
@@ -0,0 +1,15 @@
+#! /usr/bin/python3
+
+def gs(bs):
+ l={'A': 'T','T': 'A','C': 'G','G': 'C'}
+ os=''.join(l[i] for i in bs)
+ return [len(os),os]
+
+import unittest
+
+class TestGs(unittest.TestCase):
+
+ def test_ex1(self):
+ self.assertEqual(gs('GTAAACCCCTTTTCATTTAGACAGATCGACTCCTTATCCATTCTCAGAGATGTGTTGCTGGTCGCCG'),[67,'CATTTGGGGAAAAGTAAATCTGTCTAGCTGAGGAATAGGTAAGAGTCTCTACACAACGACCAGCGGC'],'example 1')
+
+unittest.main()
diff --git a/challenge-090/roger-bell-west/python/ch-2.py b/challenge-090/roger-bell-west/python/ch-2.py
new file mode 100755
index 0000000000..e63182aa61
--- /dev/null
+++ b/challenge-090/roger-bell-west/python/ch-2.py
@@ -0,0 +1,22 @@
+#! /usr/bin/python3
+
+def em(aa,bb):
+ a=aa
+ b=bb
+ s=0
+ demo=list()
+ while (a > 0):
+ line=' '.join([format(a,'5d'),format(b,'5d')])
+ if (a & 1 == 1):
+ s += b
+ line=' '.join([line,'->',format(b,'5d')])
+ a = a >> 1
+ b = b << 1
+ demo.append(line)
+ demo.append(' -----')
+ demo.append(' ' + format(s,'5d'))
+ for i in demo:
+ print(i)
+ return s
+
+em(13,238)