<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
please check the questions below.<div><br></div><div><span class="Apple-style-span" style="font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; color: rgb(68, 68, 68); "><div><span class="ecxApple-style-span" style="font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; color: rgb(68, 68, 68); "><div><div>1</div><div>&nbsp;1.1 Write a Python program with a loop that prints out a sequence of numbers as follows:</div><div>15</div><div>13</div><div>11</div><div>...</div><div>3</div><div>1</div><div>-1</div><div><br></div><div><br></div><div>1.2 Write a small Python program that generates the list of all pairs of characters c and</div><div>its doubling 2  c, where c moves through all the letters of the string "foobar" and prints it out.</div><div>The result will look like:</div><div>[(’f’, ’ff’), (’o’, ’oo’), (’o’, ’oo’), (’b’, ’bb’), (’a’, ’aa’), (’r’, ’rr’)]</div><div>Hint: use list comprehensions.</div><div><br></div><div>1.3 Write a small Python program that</div><div><br></div><div>1. prints out the length of the string</div><div>’taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu’</div><div><br></div><div>2. prints out how many different characters this string contains</div><div><br></div><div>3. replaces all the non-’t’ characters in above string with dots ’.’. So, if the word were’tattoo’, it would print ’t.tt..’.</div><div>Hints:</div><div><br></div><div>(a) use a function to t-ify the string</div><div><br></div><div>(b) there are various ways to construct the string, either using the join method or by running</div><div>a loop accumulating substrings.</div><div><br></div><div>(c) check also out what happens if you apply the conversion list(s) to a string s.</div><div><br></div><div>2&nbsp;</div><div>2.1 Write a function count char(s, c) that takes a string s, and a character c and returns</div><div>how often the character c appears in the string.</div><div>For example count_char("tattoo", "t") should return 3.</div><div><br></div><div><br></div><div>2.2 Write a Python function char_freqency(s)that returns a dictionary which, for each</div><div>character of s as a key, stores as value how often this character appears.</div><div>For example, char_frequency("tattoo") could return {’a’: 1, ’t’: 3, ’o’: 2} (the order of</div><div>key:value pairs does not matter here).</div><div><br></div><div>Hint: Consider using the function count_char defined in 2.1.</div><div><br></div><div>2.3 Write a program that translates a given string (of arbitrary length) of DNA bases into</div><div>the RNA strand that it will produce. For this, research which DNA bases correspond to RNA bases</div><div>and create a translation table (not an if...else clause!) in the Python program. [4 marks]</div><div><br></div><div><br></div><div><br></div><div>3&nbsp;</div><div><br></div><div>3.1 consider the following list of base sequences:</div><div>ACGTACCTTACTTACCAT</div><div>ATCGTACCTCTTACTCAT</div><div>The task consists of writing a Python program that performs a simple alignment algorithm on</div><div>these two strings and prints out this alignment in a suitable readable form. Give a brief comment</div><div>explaining the output format.</div><div>Hints:</div><div>1. Matching means the following: for a given sequence to be matched, your program should denote</div><div>which bases correspond to bases in the reference sequence and which do not; in addition, mark</div><div>gaps where the reference sequence contains bases which are not present in the sample sequence.</div><div>For a given sample sequence, your matching algorithm will attempt to match as many bases</div><div>as possible to those of the reference sequence.</div><div>2. This is a difficult assignment. Do not attempt it before you have solved the others.</div><div>3. For this purpose, you are allowed to research and implement publicly documented versions of</div><div>the Needleman-Wunsch algorithm or similar algorithms (however, make sure that you refer-</div><div>ence them properly!). Also make sure that your program prints out the matches/mismatches</div><div>between the sequences. You should demonstrate at least two different alignments by using</div><div>different gap penalties.</div><div>Instead of following this hint, you can develop an alternative solution to the matching problem,</div><div>e.g. based on the Levenshtein distance.</div><div><br></div><div><br></div><div><br></div><div>please help me</div><div><br></div></div></span></div></span><br><hr id="stopSpelling">From: rabidpoobear@gmail.com<br>Date: Sat, 30 Jan 2010 19:36:30 -0600<br>Subject: Re: [Tutor] can any one help<br>To: grigor.kolev@gmail.com<br>CC: invincible_patriot@hotmail.com; tutor@python.org<br><br><br><br><div class="ecxgmail_quote">On Sat, Jan 30, 2010 at 5:40 PM, Grigor Kolev <span dir="ltr">&lt;<a>grigor.kolev@gmail.com</a>&gt;</span> wrote:<br><blockquote class="ecxgmail_quote" style="padding-left:1ex">

Excuse me but I have question too.<br>
Why when i write this function in python shell not work says<br>
SyntaxError: invalid syntax<br>
but when I use IDLE make endless loop<br></blockquote><div>Your tabbing is probably messed up or something.<br><br>You guys both need to be a lot more clear with your questions.<br>If it doesn't seem like you put in the effort for a proper post then you're unlikely to get a proper reply.<br>

<br>-Luke<br>&nbsp;<br></div><blockquote class="ecxgmail_quote" style="padding-left:1ex">
Sorry I also teach Python.<br>
<div class="ecxim">&gt; def fibn(n):<br>
&gt; a,b=15,2<br>
&gt; while a&gt;n:<br>
&gt; print a, &nbsp; &nbsp; # it is same like &nbsp; &nbsp; &nbsp; &nbsp; print a, a, b = a, a+b<br>
&gt; You can not print this. SyntaxError: invalid syntax<br>
&gt; a,b=a,a+b<br>
&gt; fibn(-1)<br>
--<br>
Grigor Kolev &lt;<a>grigor.kolev@gmail.com</a>&gt;<br>
<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Tutor maillist &nbsp;- &nbsp;<a>Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a>http://mail.python.org/mailman/listinfo/tutor</a><br>
</div></div></blockquote></div><br></div>                                               <br /><hr />Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. <a href='http://clk.atdmt.com/GBL/go/196390709/direct/01/' target='_new'>Sign up now.</a></body>
</html>