I am currently working on PSet7: Similarities. I have completed all the tests so far except substrings and I was wondering if any of you could tell me where I am going wrong. I am currently failing all the tests on the substrings portions. Thank you!
def substrings(a, b, n):
"""Return substrings of length n in both a and b"""
truelines = []
asubstrings = extract(a, n)
bsubstrings = extract(b, n)
for i in range(0, len(asubstrings)):
for j in range(0, len(bsubstrings)):
if asubstrings[i] == bsubstrings[j]:
if asubstrings[i] not in truelines:
truelines.append(asubstrings[i])
return truelines
def extract(string, num):
substrings = []
for i in range(0, len(string)):
substrings.append(string[i:(i+num)])
return substrings