A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 4 years ago

solution to PS3 problem 2 using recursion: if you use recurion to solve this you have to call the function with 3 parameters : target, key and 0. Where 0 initializes the begining of where you want to start checking the string. In this recursive version I cant slice the string. from string import * # the code below is PS3 problelm 2 using recursion. #you have to call it with 3 parameters: target,key and 0 (as the begining point) # also it puts the indexes in a list instead of a tuple but that is an easy switch def match(t,k, beg): mylist= [] if find

  • This Question is Closed
  1. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    sorry some of this got cut off the first time def match(t,k, beg): mylist= [] if find(t,k,beg) >=0: mylist = [find(t,k,beg)] beg = find(t,k,beg)+1 mylist = mylist + match(t,k,beg) return mylist

  2. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    please us a code pasting site dpaste.com pastebin.com codepad.org and select Python for syntax highlighting

  3. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    not necessarily - but if you don't you may have to massage the result http://codepad.org/mP4T0PGl

  4. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.