Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Keen Group Title

PS 3, problem 2 question: What should be returned if key string is empty?

  • 3 years ago
  • 3 years ago

  • This Question is Closed
  1. Keen Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    The issue I'm mainly having is with problem 3, as it depends on the results of my work for problem 2. Looking at problem 3, it seems like problem 2 would need to return a tuple of all the indexes in the target string, but that seems really wrong, intuitively.

    • 3 years ago
  2. Keen Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Ah well, I just modified my function from problem 2 and included it in problem 3's .py file.

    • 3 years ago
  3. Aslander Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    PS 3 problem 4. gave me some problems...I ended up scrapping my entire preliminary work and redid the whole prob. set. I'm still not happy with my code though and will rework it after PS4. Keep it up Keen!

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

    It doesn't have to return anything. You can either use an 'if' statement to return None or something from the ps3.2 function, or you could structure the code that feeds that function to recognize empty keystrings and not pass them in.

    • 3 years ago
  5. Keen Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    For the subStringMatchOneSub function that's included in ps3_template.py to work properly, subStringMatchExact(target, "") needs to return range( len(target) ), where 'target' is a string of some sort. If it returns None or an empty tuple, then subStringMatchOneSub doesn't work. It'll crash with a TypeError if subStringMatchExact(target, "") returns None, actually. Also, if you run subStringMatchOneSub with the key being a 2 character string, it will find nothing if subStringMatchExact(target,"") returns an empty tuple.

    • 3 years ago
    • Attachments:

See more questions >>>

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.