A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 4 years ago
I just did ps3a and I created the iterative function. It works but if anyone has any suggestions on how to improve it and clean it up, please let me know.
http://dpaste.com/hold/694021/
anonymous
 4 years ago
I just did ps3a and I created the iterative function. It works but if anyone has any suggestions on how to improve it and clean it up, please let me know. http://dpaste.com/hold/694021/

This Question is Closed

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Ok! This is what I got for ps3a. I´m not sure if I understood correctly what it is that it asked for, since it was way too easy, in comparison to the last assignments, to get to it. def countSubStringMatch(target, key): x = target y = key z = 0 ctr = 0 while find(x,y, z) != 1: if find(x,y,z) == z: ctr += 1 z += 1 print ctr Can anyone please enlighten me on what it is that needs to be done so that I can get my butt kicked like I´m supposed to?

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0Oh! And while I´m at it, here´s my answer to PS3b: def SubStringMatchExact(target, key): x = target y = key z = 0 while find(x,y, z) != 1: if find(x,y,z) == z: print z z += 1 Again... I´m pretty sure I´m not doing what they´re asking of me. Can anyone help?

maitre_kaio
 4 years ago
Best ResponseYou've already chosen the best response.0EFarias: your implementations give the right results, so it"s ok. Don't worry about the difficulty, the maths will come back soon ! Just a few notes: 1. You don't have to rename the parameters. Just use target and key in the function. 2. For substringMatchExact (but I guess it makes sense for the other functions too), you should return a value, not print it. 3. Your code is not very efficient, since in the while loop you are searching a first time for the key from pos z, if you find it, you continue to search it until the position where key is found is equal to z, incrementing z by 1 each time. You could do better by setting z to the right position.

anonymous
 4 years ago
Best ResponseYou've already chosen the best response.0what is your code for the recursive part of this same question
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.