Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

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)
See more answers at brainly.com
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.

Join Brainly to access

this expert answer

SEE EXPERT ANSWER

To see the expert answer you'll need to create a free account at Brainly

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
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.
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.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question