A community for students.
Here's the question you clicked on:
 0 viewing
tcc8m
 2 years ago
Does anyone have the answer(code) to Problem 3(multilevel encryption & decryption) from Problem set #4?
I did not see that answer in the solutions file. Thanks.
tcc8m
 2 years ago
Does anyone have the answer(code) to Problem 3(multilevel encryption & decryption) from Problem set #4? I did not see that answer in the solutions file. Thanks.

This Question is Closed

harsimran_hs4
 2 years ago
Best ResponseYou've already chosen the best response.1hey a better way would be you write your own code and then if you face any problem put it here if you have already written then you may post your code here for discussion

tcc8m
 2 years ago
Best ResponseYou've already chosen the best response.0Ok I tried to make an attempt at this problem (attached below). My answer is wrong. Can someone provide the correct code and/or evaluate my code. Thanks. http://pastebin.com/0Y67n61r

TuringTest
 2 years ago
Best ResponseYou've already chosen the best response.0I did this problem for edX, which is based on the OCW version, but I don't seem to have a function "apply_shifts" I have "apply_shift" and "find_best_shift", but it didn't require tuples so it's hard for me to figure out how to make compare your code and mine.

harsimran_hs4
 2 years ago
Best ResponseYou've already chosen the best response.1actually i didn`t get what whole of your code meant but still i recommend that you have different functions one creating the dictionary with letter as key and shifted one{which you have already done as build_encoder (perhaps) other function of applying the shifts i.e apply_shifts i had followed this approach take some newstring then suppose you have to apply (3, 6) sought of thing newstring = pick upto 3rd letter the input text + shifted text for the rest try it by this approach if still there is any problem i will elaborate using my code Hope this helps

tcc8m
 2 years ago
Best ResponseYou've already chosen the best response.0Thanks guys for the input. I just found my mistake. My new code works. My mistake was that in line 28 of the previous code I inputed "placeholder[key:]" whereas I should have used just "placeholder". I changed that variable name to new_shift in the code below. Placeholder was a terrible name for that variable. Cheers. http://pastebin.com/cuyib61q

harsimran_hs4
 2 years ago
Best ResponseYou've already chosen the best response.1how about this one...much shorter tough http://pastebin.com/gicZ3qYc
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.