Objective
Create a Python program that encrypts a text with the Caesar cipher, which shifts each letter a fixed number of positions in the alphabet.
Instructions
- Read the shift, an integer (it can be negative), and then the text.
- Shift each letter of the English alphabet (from
atoz) by the given number of positions, going back to the start when it goes pastz. Keep whether the letter was upper or lower case. - All other characters (spaces, numbers and signs) are left unchanged.
- Show the encrypted text.
ord,chrand the%operator will be useful.
3
Hola Mundo
Krod Pxqgr
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise