How would you approach comparing two lists and “looking back”?
I’m comparing the elements of two lists like this:
score = 0
for (x,y) in zip(seqA,seqB):
if x == y:
score = score +1
if x !=y :
score = score - 1
Now I would like score + 3 if the previous pair was a match, so basically I would have to “look back” one iteration.
Just save the result of the last match.