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

I'm working on ps 3, problem 2 (ps3b.py). I was able to get an iterative version to work. For practice I'm also working on a recursive version. Here's what I have so far: http://codepad.org/wWjN7FdF You'll see that the problem is that the recursive version I wrote submits a reduced string back into the function so the second time the key is found, it's relative to the first position rather than an absolute position. Is this solvable recursively without adding a third argument containing where to start searching from?

OpenStudy (anonymous):

i couldn't think of one but - the information you want is contained in the tuple that is returned. you just have to massage it a bit after you get it: http://dpaste.com/707092/

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!