I do not understand problem 3 in the problem set 3, it would be a great help if someone could explain it briefly :)
So, you should already have a function that returns the tuples of starting points of matches for a key string within a target string. Given that you have that, write a function that takes two sets of tuples generated by this function and the length of the first key as its arguments. (This means, assume you have these values to work with.) Hence: def constrainedMatchPair(firstMatch, secondMatch, length): the idea is that you take the first value from within firstMatch, add the key's length to it, and, if this value +1 equals any value within the tuple within secondMatch, then you have a 'close match at least' at these points. (see the output - http://codepad.org/rQjiwjjp - of my function to get an idea about this.) so, you'll have found the starting point of the first string, added the length of the string to it, and then added 1 to account for an empty space as a catch all for any character. If this value equals the the value of any values in secondMatch, you have a possible match. Note that all you have to do is write the function to do this for a given firstMatch, secondMatch and length - you don't have to write the code that breaks up a key into all it's possible sub-strings - the profs do that for you in def subStringMatchOneSub(target, key): good luck!
Thank you, I do understand it now!
Join our real-time social learning platform and learn together with your friends!