diff options
Diffstat (limited to 'challenge-090/roger-bell-west/python')
| -rwxr-xr-x | challenge-090/roger-bell-west/python/ch-1.py | 15 | ||||
| -rwxr-xr-x | challenge-090/roger-bell-west/python/ch-2.py | 22 |
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) |
