anonymous
  • anonymous
I'm confused by the example result of build_coder(3) in problem set 4. The dictionary contains two values that map to space (' '). 'X' and 'x'. Also nothing maps to 'C'. Is this something incorrect in the example or is this intentional?
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
I'm also wondering about this too. Even the posted ps4_encryption_sol.py doesn't work correctly. enc = apply_shift ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ", 3) print '"' + apply_shift (enc, 24) + '"' output: "ABCDEFGHIJKLMNOPQRSTUVWxYZabcdefghijklmnopqrstuvwxyz " Also, couldn't get the posted solution file to properly decrypt the fable.txt. Anyone have any suggestions?
anonymous
  • anonymous
@KCHARLES did you implement a solution and try it? i get the same 'mapping' as the docstring example ``` >>> >>> build_coder(3) == {' ': 'c', 'A': 'D', 'C': 'F', 'B': 'E', 'E': 'H', 'D': 'G', 'G': 'J', 'F': 'I', 'I': 'L', 'H': 'K', 'K': 'N', 'J': 'M', 'M': 'P', 'L': 'O', 'O': 'R', 'N': 'Q', 'Q': 'T', 'P': 'S', 'S': 'V', 'R': 'U', 'U': 'X', 'T': 'W', 'W': 'Z', 'V': 'Y', 'Y': 'A', 'X': ' ', 'Z': 'B', 'a': 'd', 'c': 'f', 'b': 'e', 'e': 'h', 'd': 'g', 'g': 'j', 'f': 'i', 'i': 'l', 'h': 'k', 'k': 'n', 'j': 'm', 'm': 'p', 'l': 'o', 'o': 'r', 'n': 'q', 'q': 't', 'p': 's', 's': 'v', 'r': 'u', 'u': 'x', 't': 'w', 'w': 'z', 'v': 'y', 'y': 'a', 'x': ' ', 'z': 'b'} True >>> ```
anonymous
  • anonymous
@phyre - did you write your own solution for the multi level decrypt? I have a working solution and will help if you are stuck

Looking for something else?

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

More answers

anonymous
  • anonymous
That can be considered part of the function's specification - it is showing you the correct result for a shift of 3. That portion of the docstring can be used to test the function: http://docs.python.org/2.7/library/doctest.html
anonymous
  • anonymous
@bwCA - Thanks for your reply. I've been writing the PS in another prog language and haven't written the python version yet. I assumed the solution was complete, which is my fault. But still wondering about the mapping issue. Consider this example. enc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" for x in range (27): enc = apply_shift (enc, 1) print enc output: abcdefghijklmnopqrstuvwxyz For each shift, an uppercase letter will be assigned a space and then on the following shift, the space will then become lowercase. The solution is not case sensitive. Any thoughts? @KCHARLES - sorry for hijacking your thread.
anonymous
  • anonymous
My approach is not to question why they want a solution implemented a certain way and to concentrate on implementing a solution that meets their specifications - I am sure they (the client) have their reasons. What appears to be a glitch to you may be an important implementation detail to them. For the edX course this was very important as they have automated checking the answers - if your solution did not fully comply, including where a space might be in the resultant text output, you got it wrong. There seems to be a philosophy that a good approach to writing code is to write the tests first based on the specs then write the code so that it passes the tests. Thats kinda what those docstring examples are telling you.
anonymous
  • anonymous
@bwCA - Not really sure why they didn't implement a case-sensitive solution. Seems like you should be able to use mod 26 for A-Z and mod 27 for a-z + ' '. Anyway, I got a solution but it's not a 100% correct. It's Aesop fable - The Flying Machine. My differences between the actual fable and program output below: fable | prog output ------------------------------------- out barely in | out a rely in a add hat the | a look at the merely basic and | merely a sic and came forward with | came ox ward with Were you able to get 100% correct output?
anonymous
  • anonymous
it is possible that two different shifts will produce a word at the starting point - did you allow for that? if so, how did you decide which one to choose? I had similar.same errors (most people that post here seem to have the same errors) until someone posted this phrase of random words to decode - once i was able to decode it i got 100% on the fable ``` clear = 'adeptly polkaed matriarch sixths breakage' shifts = [(0, 2), (8, 12), (16, 0), (26, 17), (33, 0)] cipher = 'cfgrvn bcbzyosrn ogewoeqvnwmaxlwdfvieoeki' ```
anonymous
  • anonymous
@bwCA - Thanks for the example. Finally got it 100%. I made a case sensitive version using mod 53 (A-Z, a-z, ' '), worked OK, but got many quite not 100% results. Probably need more debugging but need to move on. Anyway, thanks again.

Looking for something else?

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