In this problem, you will implement a transposition cipher that, instead of dividing the original text into odd and even characters, separates it into three sets of characters. As an example, we will...


In this problem, you will implement a transposition cipher that, instead of dividing the original text into odd and even<br>characters, separates it into three sets of characters. As an example, we will use this 1977 quote by Digital Equipment<br>Corp. president Ken Olson --

Extracted text: In this problem, you will implement a transposition cipher that, instead of dividing the original text into odd and even characters, separates it into three sets of characters. As an example, we will use this 1977 quote by Digital Equipment Corp. president Ken Olson -- "There is no reason anyone would want a computer in their home." (Spaces are represented with the square u-like character.) There is no reason anyone would want a computer in their home. Rail 1: T r S d i t i h a C. e Rail 2: e a u a u in h Rail 3: a W n. m m Example three-rail transposition. The resulting encrypted text is produced by reading the text horizontally, i.e., adding the three rails: Rail 1 + Rail 2 + Rail 3 = **“Trinrs yeoda cpeitihehesoeoao u naournhro.e annnwlwt mt e m" (without the quotes). Requirements: Implement the three-rail transposition cipher above, placing your code in the file p4_2.py (template I provided, replace comment at the beginning of the file with your own code). Feel free to develop your code in PyCharm or the IDE of your choice, then upload or paste it into Coding Rooms. Because this is our first assignment here, just as a backup, also submit your python files through the Canvas assignment for Project 4. In your p4_1.py module, define the functions main(), encrypt(msg: str) +→ str and decrypt(msg: str) +→ str. You may define other functions as you see fit, but these three must match the interface speciffied here. • The encrypt function should take in the original text and use the three-rail encryption approach described above, returning the encrypted string. Include docstring with doctests. • The decrypt function should assume that the msg is already encrypted as described above, and decrypt it, returning the original text. Include docstring with doctests. The main function should prompt the user for some input, then ask whether to encrypt or decrypt it, calling the appropriate function, and printing the result.
Examples:<br>Running (with

Extracted text: Examples: Running (with "Run" in Coding Rooms or your IDE) and choosing E for encryption: Do you wish to encrypt or decrypt a message [E/D]? E Enter a line of text to encrypt: There is no reason anyone would want a computer in their home. Encrypted text: Trinrs yeoda cpeitihehesoeoao u naournhro.e annnwlwt mt e m Running (with "Run" in Coding Rooms or your IDE) and choosing D for decryption: Do you wish to encrypt or decrypt a message [E/D]? D Enter encrypted text to decrypt: Trinrs yeoda cpeitihehesoeoao u naournhro.e Decrypted text: There is no reason anyone would want a computer in their home. annnwlwt mt e m
Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here