Code Louisville Python programming exercise.
In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code, or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence.
From: Caesar cipher on wikipedia.org
In this exercise we will implement a Caesar cipher with a shift of 5. The program should ask the user for a plain text sentence and print the encrypted text.
Here is an example execution of the program:
Please enter a senctence: python is fun!
The encrypted sentence is: udymts nx kzs!
Note that the program should not replace special characters like spaces or exclamation marks.
- Clone the repo to your machine
- Add your code to the
cipher.py
file
This exercise is based on the Caesar cipher exersise in the openSAP Python for Beginners course.