Question: Python Using Jupyter Notebook Coding exercise #C2 A Caesar cipher is a simple substitution cipher based on the idea of shifting each letter of the

Python Using Jupyter Notebook

Coding exercise #C2

A Caesar cipher is a simple substitution cipher based on the idea of shifting each letter of the plaintext message a fixed number (called the key) of positions in the alphabet. For example, if the key value is 2, the word "Sourpuss" would be encoded as "Uqwtrwuu." The original message can be recovered by "reencoding" it using the negative of the key. Write a program that can encode and decode Caesar ciphers. The input to the program will be a string of plaintext and the value of the key. The output will be an encoded message where each character in the original message is replaced by shifting it key characters in the Unicode character set. For example, if ch is a character in the string and key is the amount to shift, then the character that replaces ch can be calculated as: chr (ord (ch) + key). It has to deal with the case when we "drop off the end" of the alphabet. Make sure that you use a circular shift over the entire sequence of characters in your alphabet string. Ex1:

Enter the phrase >> SamuelMatos Enter the key of the cipher >> 20 The original phrase: SamuelMatos The cipher output: MugoyfGunim

Ex2:

Enter the phrase >> OajsalknAujsaj Enter the key of the cipher >> 598 The original phrase: OajsalknAujsaj The cipher output: OajsalknAujsaj

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!