CSCI 131 – Python Language



Python Language

• Input/Output Redirection

• Functions

• Strings

Example 1:

Write a Python program that accepts as an input two strings and finds the maximal alignment score if no internal gaps are allowed and the score of match is 1 and the score of mismatch is 0. The gaps at the beginning and the end of the short sequence are allowed and will be counted as mismatches. The program prints the best alignment.

You can assume that length (first sequence) >= length (second sequence)

Solution:

#function definition

#function calculates the alignment score of seq1 and seq2

def scoreAlign (seq1, seq2):

i=0

sum=0

length=len(seq1)

while i ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download