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

tcc8m Group Title

This question relates to PS #4. All of my functions are working correctly, except for my decrypt_fable(). When I run the code it does not terminate. I've attached my code for all of the other functions. decrypt_fable() is at the bottom of the code (lines 388-403 in pastebin). Any help is appreciated. http://pastebin.com/2MnZyuDp

  • one year ago
  • one year ago

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

    I put in a print statement to print each "new_string" through the loop which showed me it was continuing to work and it does eventually complete. It just takes a while, if you do the same you may also notice some things that may be able to be changed to improve the speed. ie: some words toward the end of the string are solved early on but discarded because the code is only looking at "the next word". Haven't thought about how easy or hard a different approach would be.

    • one year ago
  2. msmithhnova Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    I just found my code for this and it is virtually identical to yours.

    • one year ago
  3. tcc8m Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks msmithhnova. I may have used the code you posted for find_best_shifts_rec. I noticed msmithhnova that you had another find_best_shifts function that called on the recursive function. Why did you need that function? Also, how do these functions account for single letter words such as "A" and "I". I noticed while running the find_best_shifts_rec functions that the program is interpreting "A" as a word too many times. First word is "A", second word is "An", third word is "A". Is that right?

    • one year ago
  4. tcc8m Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Here is the function I am referring to. http://pastebin.com/uygQFaFP

    • one year ago
  5. msmithhnova Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    That is not a function I really use in the way I coded it but it looks to me that it would build up a list of shifts that it found and then apply them all to the string at the end rather than as it is processing. It could be useful if you were deciphering multiple texts using the same series of shifts. Once you have the shift list you can simply apply it to a new text rather than decoding again. I'm not sure where the 'A', 'An', 'A' comes in that you are talking about but since the shifts are decoded at the start of words then a space following a word indicates that it is the correct word whether it is 1 or more letters.

    • one year ago
  6. tcc8m Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks msmithhnova. You've been helpful.

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