## Screech 3 years ago Working on the OPT.2 Cyclic cipher. So far, the tricky part of the exercise is trying to understand the write-up. In step 3, it says "we want the values of the numbers to remain between 0 and 5". Why do we want this? The write-up doesn't explain. I would have thought that digits 0-9 would be wanted. What am I missing here ?

1. snark

it's a toy example, their example alphabet is 012345, doesn't go as high as 6. They want the numbers to stay within 0-5 in the example. they could have choosen 0123456789, but didn't. replace the "we" by "them", as in them people want....

2. ravi_s

The modulus operator (%) in X % Y implies number 0 to Y-1. Multiples of Y will result in 0 as the result. For example if Y is 10, whenever X is 10, 20 , 30 or multiples of 10 the % will always result in 0. In other cases it is between 1 to 9. This is explained simply in the course material. 'A' to 'Z' goes from 65 to 91. 'a' to 'z' goes from 97 to 122 in ordinal values. One can calculate modulus separately depending on the values by using either 92 or 123 as Y ... Hope this helps?

3. FabienToune

This example doesn't relate to the "main" exercise, it's just a way to show how to cycle through an arbitrary number of element in a list. Thus, they use an example with 6 element so you can keep an eye on each of them. For the "main" cipher exercise, you'll have to do the same with 26 elements for lowercase and 26 elements for uppercase.

4. Screech

Thanks to all who clarified this. The exercise is very poorly written. Would have been helpful to reference the symbol alphabet being used and which would be encoded. Something like "Assume that the you will encode any of the 6 symbols "012345" when they occur in the input and that your input sequence is "012345". The initial line of the exercise indicates that it is tricky. I believe it is tricky mostly because it is poorly worded. I'll close out this question in awhile.