Question: 2 . Write python program for the Caesar cipher with the following requirements: ( 1 ) Define a function to encrypt with the following header.

2. Write python program for the Caesar cipher with the following requirements:
(1) Define a function to encrypt with the following header. It takes in an English message (containing 26 letters only) and a key between 0 and 25 inclusively, and returns the ciphertext:
def encrypt(message, key):
(2) Define a function to decrypt with the following header. It takes in a ciphertext and a key between 0 and 25 inclusively, and returns the plaintext:
def decrypt(ciphertext, key):
(3) Define a main() function. First, it asks user what to do: encrypt or decrypt. Once the user makes the choice, it then asks for the text and the key. It should output the corresponding results.
def main():

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 Programming Questions!