[Verba] Nemesis Coding (revisited) and DNA coding
Stuart D. Gathman
stuart at gathman.org
Sun Jan 29 00:25:01 EST 2006
On Sun, 29 Jan 2006, Stuart D. Gathman wrote:
> Here is an outline of your program to get you started. It will use all
> the things you have (hopefully) learned so far.
>
> 1. Make a function (remember 'def') to convert the letters of a DNA
> sequence to a number.
>
> 2. Make a function to convert a number to the letters of a DNA sequence.
> (You need some sophisticated equipment to actually convert to a DNA
> sequence :-)
>
> 3. Read a sequence, convert to a number, NOT, convert to letters again,
> print.
Actually, it is simpler if you just build the antisense letter by letter.
So ignore the above.
You might want to use a feature of python we haven't encountered yet:
the "for" loop. Strings, tuples, and lists are sequences. You can
do something with each member of a sequence in turn like this:
>>> s = 'ABC'
>>> for c in s: print ord(c),
...
65 66 67
You will find this very useful.
--
Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
More information about the Verba
mailing list