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
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...
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.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F734f4932-9c15-4e07-80c9-d54d94f3ad88%2Fdc4c714e-83ff-4419-8cb7-eea841edb30c%2Faep574j_processed.png&w=3840&q=75)
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F734f4932-9c15-4e07-80c9-d54d94f3ad88%2Fdc4c714e-83ff-4419-8cb7-eea841edb30c%2Fdxfmmat_processed.png&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
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](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY