Good work so far! It turns out that congruences are very much relevant to computer science. If anyone has ever suggested to you that you should encrypt your files using a cipher, then you have indirectly seen congruences in action! One of the earliest and simplest ciphers known in cryptography is the Caesar cipher. The cipher takes some user-provided String (or sequences of letters, in this case) and shifts each letter in that String three letters down the alphabet.
Coding a Caesar cipher in Python requires the knowledge that each letter can be represented by a number. For instance, since A is the first letter in the English alphabet, we cast A as the number 0; likewise, B is set to 1, C is set to 2, and so on until we reach Z, or 25. If we seek to perform a shift in the letter Z, then counting the next letter means returning to the beginning of the alphabet (so starting at A); from there, we continue counting letters until we have counted 3 total. Ultimately, Z will be coded as a C using the Caesar cipher.
Don’t worry, we don’t expect you to know how to fully code in this cipher just yet! However, we will ask you in the upcoming checkpoint to perform a Caesar cipher on a simple String by hand and check your result using Python.
Perform a Caesar cipher on the phrase
'hello world' by hand. Once you have your answer, create a variable called
answer and set it equal to your result.