Why are we adding 10 in letter_value?

guys plz tell me , why are we adding 10 in letter_value ??

This message has an offset of 10 , what its mean ??

The message has a Caesar cipher, which is a coded message where each letter in the message is replaced by another letter a fixed number of positions away. So for example, a Caesar cipher with an offset of five could look like this:
A = F
B = G
C = H
and so on and so forth.

So here, it says there is an offset of 10, meaning that each letter in the alphabet is shifted 10 places down. As you can see in the solution, the letter “x” turned into an “h”, which is 10 places down.

To make this easier, the code assigns each letter in the alphabet with a value, which you can assume A = 1, B = 2, and so on so forth. So in the loop, you see that each letter in the coded message is has its own number, assigned to letter_value, which is then added by 10, in order to decode it. The modulo there is to account for letters with shifts that go past the alphabet, or go past “z”.

I hope this helps! Sorry if it’s confusing, but if you need more clarification, I’d be glad to give it

2 Likes

:smiley: thank you so much , i got it.

i think , you just cleared my doubts with additional info. and well explained , Thank you.

and it is not confusing , it definitely helps a lot to me …

2 Likes

Of course! You’re very welcome :yellow_heart:

1 Like