I keep getting the error 'int' object is not iterable, but I can't figure out why, any suggestions?
def printMatching(seq1, seq2):
is_match = []
if len(seq1) < len(seq2):
short_seq = seq1
else:
short_seq = seq2
for i in len(short_seq):
if seq1(i) == seq2(i):
is_match.append(true)
else:
is_match.append(false)
def main():
seq1 = "abaababb"
seq2 = "aabbaababa"
printMatching(seq1, seq2)
for i in len(short_seq)is wrong. One can't iterate a number. It is just a number. Usefor i in range(num)to iterate[0..n)or just iterate the sequence directly. In this case I suspect that usingzipand/or comprehensions would be useful.