hii am stuck in these questions can someone please help me in solving and
writing programme for these tasks
please help me
1 1.1 Write a Python program with a loop that prints out a sequence of numbers
as follows:151311...31-1
1.2 Write a small Python program that generates the list of all pairs of
characters c andits doubling 2 c, where c moves through all the letters of
the string "foobar" and prints it out.The result will look like:[(’f’, ’ff’),
(’o’, ’oo’), (’o’, ’oo’), (’b’, ’bb’), (’a’, ’aa’), (’r’, ’rr’)]Hint: use list
comprehensions.
1.3 Write a small Python program that
1. prints out the length of the
string’taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu’
2. prints out how many different characters this string contains
3. replaces all the non-’t’ characters in above string with dots ’.’. So, if
the word were’tattoo’, it would print ’t.tt..’.Hints:
(a) use a function to t-ify the string
(b) there are various ways to construct the string, either using the join
method or by runninga loop accumulating substrings.
(c) check also out what happens if you apply the conversion list(s) to a string
s.
2 2.1 Write a function count char(s, c) that takes a string s, and a character
c and returnshow often the character c appears in the string.For example
count_char("tattoo", "t") should return 3.
2.2 Write a Python function char_freqency(s)that returns a dictionary which,
for eachcharacter of s as a key, stores as value how often this character
appears.For example, char_frequency("tattoo") could return {’a’: 1, ’t’: 3,
’o’: 2} (the order ofkey:value pairs does not matter here).
Hint: Consider using the function count_char defined in 2.1.
2.3 Write a program that translates a given string (of arbitrary length) of DNA
bases intothe RNA strand that it will produce. For this, research which DNA
bases correspond to RNA basesand create a translation table (not an if...else
clause!) in the Python program. [4 marks]
3
3.1 consider the following list of base
sequences:ACGTACCTTACTTACCATATCGTACCTCTTACTCATThe task consists of writing a
Python program that performs a simple alignment algorithm onthese two strings
and prints out this alignment in a suitable readable form. Give a brief
commentexplaining the output format.Hints:1. Matching means the following: for
a given sequence to be matched, your program should denotewhich bases
correspond to bases in the reference sequence and which do not; in addition,
markgaps where the reference sequence contains bases which are not present in
the sample sequence.For a given sample sequence, your matching algorithm will
attempt to match as many basesas possible to those of the reference sequence.2.
This is a difficult assignment. Do not attempt it before you have solved the
others.3. For this purpose, you are allowed to research and implement publicly
documented versions ofthe Needleman-Wunsch algorithm or similar algorithms
(however, make sure that you refer-ence them properly!). Also make sure that
your program prints out the matches/mismatchesbetween the sequences. You should
demonstrate at least two different alignments by usingdifferent gap
penalties.Instead of following this hint, you can develop an alternative
solution to the matching problem,e.g. based on the Levenshtein distance.
please help me
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
http://clk.atdmt.com/GBL/go/196390706/direct/01/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor