Changes

From Biolecture.org

Minsu Kim/python/Rosalind / problem10

1,036 bytes added, 21:44, 12 December 2017
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&..."
<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(&#39;rosalind_ba1m.txt&#39;,&#39;r&#39;)<br />
ind = int(f.readline())<br />
k = int(f.readline())<br />
f.close</p>

<p>a = []<br />
for i in range(0,k):<br />
&nbsp; &nbsp; d = 4**(k-i-1)<br />
&nbsp; &nbsp; count = 0<br />
&nbsp; &nbsp; if d &gt; ind:<br />
&nbsp; &nbsp; &nbsp; &nbsp; a.append(&#39;A&#39;)<br />
&nbsp; &nbsp; else:<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(d&lt;=ind):<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ind -= d<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; count += 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; if count==1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a.append(&#39;C&#39;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if count==2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a.append(&#39;G&#39;)<br />
&nbsp; &nbsp; &nbsp; &nbsp; if count==3:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; a.append(&#39;T&#39;)<br />
print(&quot;&quot;.join(a))</p>
Anonymous user

Navigation menu