Hi all, working on problem set 3 part 2. Keep getting stuck in a loop if there is more than one match. ``` def subStringMatchExact(x, y): total_count = 0 n = 0 results = () while find(x[n:], y) >= 0: # while there is a match new_n = find(x[n:], y) # attribute a new value of n print new_n results.append(new_n) # add the match to the results tuple n = new_n + 1 # change n to the new value total_count += 1 # add 1 to the total matches print total_count return results ``` It seems to change the string length when the start position changes.
Well, the string length being compared will change. You are passing a shorter sub string. You need to account for the fact that you are not starting at 0 when you advance.
Thanks. Working now as intended.
=)
Join our real-time social learning platform and learn together with your friends!