Open main menu

Biolecture.org β

Minsu Kim/python/Rosalind / problem11

This problem is so similar to previous problem (10)

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))