```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ``` ```def pairwiseScore(seqA, seqB): score = 0 bars = [str(' ') for x in seqA] #create a list filled with number of spaces equal to length of seqA string. It could be also seqB, because both are meant to have same length length = len(seqA) similarity = [] for x in xrange(length): if seqA[x] == seqB[x]: #check if for every index 'x', corresponding character is same in both seqA and seqB strings if (x >= 1) and (seqA[x - 1] == seqB[x - 1]): #if 'x' is greater than or equal to 1 and characters under the previous index, were same in both seqA and seqB strings, do.. score += 3 similarity.append(x) else: score += 1 similarity.append(x) else: score -= 1 for x in similarity: bars[x] = '|' #for every index 'x' in 'bars' list, replace space with '|' (pipe/vertical bar) character return ''.join((seqA, '\n', ''.join(bars), '\n', seqB, '\n', 'Score: ', str(score))) print pairwiseScore("ATTCGT", "ATCTAT"), '\n', '\n', pairwiseScore("GATAAATCTGGTCT", "CATTCATCATGCAA"), '\n', '\n', pairwiseScore('AGCG', 'ATCG'), '\n', '\n', pairwiseScore('ATCG', 'ATCG') ```
 ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ``` ```ATTCGT || | ATCTAT Score: 2 GATAAATCTGGTCT || ||| | CATTCATCATGCAA Score: 4 AGCG | || ATCG Score: 4 ATCG |||| ATCG Score: 10 ```