Minsu Kim/python/Rosalind / problem10

From Biolecture.org
Revision as of 21:44, 12 December 2017 by imported>Minsukim (Created page with "<p><img alt="" src="/ckfinder/userfiles/images/bandicam%202017-12-12%2021-33-53-945.jpg" style="height:252px; width:639px" /></p> <p>f = open('rosalind_ba1m.txt','r&...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

f = open('rosalind_ba1m.txt','r')
ind = int(f.readline())
k = int(f.readline())
f.close

a = []
for i in range(0,k):
    d = 4**(k-i-1)
    count = 0
    if d > ind:
        a.append('A')
    else:
        while(d<=ind):
            ind -= d
            count += 1
        if count==1:
            a.append('C')
        if count==2:
            a.append('G')
        if count==3:
            a.append('T')
print("".join(a))