n this problem, you will mple cipner thlat, instead of dividng the text mtO ouu 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: Rail 2: T r i n e d a e i t i h e a. u a u n h r Rail 3: e a n t 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: mplement the three-rail transposition cipher above, placing your code in the file p4_2.py (template provided, replace comment at the beginning of the file with your own code). Feel free to develop your code in PyCharm or the DE of your choice, then upload or paste it into Coding Rooms. Because this is our first assignment here, just as a packup, also submit your python files through the Canvas assignment for Project 4. n 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 specified 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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
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.
Transcribed Image 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:
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
Transcribed Image 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY