anonymous
  • anonymous
Exercise OPT.2 – Secret Messages (Homework 1) I don't really get the step 3. Why should the values remain in range (0,5)? Or rather why do we have to do the modulus? Somehow I don't see how do I do it after I managed to replace all the letters with "x"'s. Thanks!
MIT 6.189 A Gentle Introduction to Programming Using Python (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.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
I think I expressed a similar question when our class hit this exercise. You can review the thread of the discussion here http://openstudy.com/study#/updates/508f05b9e4b043900ad89834 Hope that the discussion which ensued clarifies the exercise for you
anonymous
  • anonymous
I agree with Screech's thread. That step is just poorly worded and can be basically ignored. Just focus on creating a function that will take a user's string input and return an ascii shifted message back. That is the purpose of the exercise. Good luck.
anonymous
  • anonymous
Looked closer at Opt.2 Secret Messages exercise: first I simply shifted the ascii value over by the designated amount ('A' = 65, shift 4 over would be '69'). This works fine for all characters except the last 9 of the set (88-97) and (120-129). These outer cases are where they expect us to modify our ascii character using the modulus operator to keep the secret letter value within the range A-Z or a-z respectively. Handle each range using for loops and the 'ord' and 'chr' functions from the examples.

Looking for something else?

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