Working on ps3, problem 3. I've written constrainedMatchPair such that when I run subStringMatchOneSub("atgc","atgacatgcacaagtatgcat"), I get (5, 15, 5, 15, 5, 15, 0, 5, 15). I figure this is not ideal (due to the duplicates) but I can't think of a way to avoid duplicates in the tuple without editing the provided code for subStringMatchOneSub. Am I missing something? Or can I consider myself done with this problem?
It doesn't sound like you did the problem correctly, you should figure out why there are duplicate answers. Paste your code to dpaste.com then post the link here - we can help solve the problem.
I wrote a couple of test functions to test constrainedMatchPair and subStringMatchExact - both of yours passed. then I looked at subStringMatchOneSub which was provided for us and realized that that is how it works.... The duplicates you are seeing are correct - line 38 (of your dpaste code) is where the individual results get concantenated. Here are the two test functions i wrote, if you are interested: http://dpaste.com/552922/ when debugging, sometimes it helps to write fuctions that test pieces of your code so you can find which part isn't working.
Great. I tried writing a bit of code to eliminate duplicates but it turned out to be rather difficult. Now I can move on feeling content. Thanks for the help!
alright this may sound stupid but how do you see the results? i run this and then type: >>>subStringMatchExact("attaboy","a") # i hit enter >>> #then a blank line show up? how do i see the result of the tuple >>> (0,3)
your function needs to return the variable that your trying to "compute" see this: http://dpaste.com/553419/ after you have defined a function you can assign what is returned to another variable. in idle if you just type this new variable it will show you what it is. or you can print it. or you can just run the function without assigning its result to anything and idle will display the returned 'thing'
Join our real-time social learning platform and learn together with your friends!