Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 19 Online
OpenStudy (anonymous):

I am still muddling through pset3, and am now trying to use the provided subStringMatchOneSub template with my functions. I am trying ("atgc", "atgacatgcacaagtatgcat"). It responds "breaking key atgc into tgc", which tells me key1 for the first pair is just a blank. It then gets hung up in my "...Exact" function on a line that says "z += y + 1". I'm thinking the fact that I'm searching target for nothing is confusing it. I tried quickly inserting an "if len(key1) < 1" line to tell it what to do in this case, but it just said that key has no type. If this is something I should just work ou

OpenStudy (anonymous):

hm, some of my question seems to have disappeared! The rest of it just thanked any potential responders for their help.

OpenStudy (anonymous):

Can you attach your codes? Your ...Exact() function might not be compatible with the one calling it.

OpenStudy (anonymous):

kcpaas, thank you for being willing to take a peek at the code. I messed with it some more and it is now sort of working. I attached the file below (saved in Idle). I fixed the original problem with a line in subStringMatchExact "if len(key) > 0". After that I had a bunch more issues which seemed to be resolved by adding "return b" to the end of constrainedMatchPair. Now, it gives me empty tuples when I think it means index 0, and duplicates answers sometimes, but at least it doesn't get stuck on error messages. Also, I think this is somewhat clunky with all the "if"s and "while"s. If anyone has time to take a peek at it and give advice on how to clean it up, I would appreciate it very much-but since it's sort of working, I think I might move on anyway. Thanks again!

OpenStudy (anonymous):

I put in some comments like sample outputs and suggestions for improvement. I didn't put in some actual codes for implementation. You should figure that out. :)

OpenStudy (anonymous):

This is very helpful, thank you very much!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!