Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON 9.13 LAB: The Caesar cipher In cryptography, Caesar's cipher is one of the simplest and most widely known encryption techniques. The method is named

image text in transcribedimage text in transcribedPYTHON

9.13 LAB: The Caesar cipher In cryptography, Caesar's cipher is one of the simplest and most widely known encryption techniques. The method is named after Julius Caesar, who used it in his private communication. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. We wish to implement Caesar's encryption scheme by substituting each alphabet in the string with another alphabet that occurs three shifts to its left. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. Note that that the code wraps around in that A would be replaced by X, B would be replaced by Y, and C would be replaced by Z. Write a function called encrypt that takes two input arguments: the plaintext and the number of left shifts to use when constructing the cipher, and returns the encrypted string. For example, if the user enters plaintext-"ICAME I SAW I CONQUERED and shift 3, then cipherencrypt (plaintext, shift) should return as the cipher. Also, note that white spaces in the plaintext occur as themselves in the cipher as well. Finally, your code must work correctly for lower case letters as well as a mix of upper and lower case letters. For example, if plaintext " came I saw I conquered and shift 3, then cipherencrypt (plaintext, shift) should return F zxjb F pxt F zlknrboba as the cipher. LAB 9.13.1: LAB: The Caesar cipher ACTIVITY main.py 1 def encrypt(plaintext, shift): "" "The encrypt function The encryption scheme is to substitute each alphabet in the string with another alphabet "shift" shifts to its left. For example, if shift 3, 4 6 Plain: ABCDEFGHIJKLMNOPQRSTUVWXYZ Cipher: XYZABCDEFGHIJKLMNOPQRSTUVW 10 If the plaintext contains spaces, they occur as themselves in the cipher. 12 13 14 15 cipher-" """Write your code here to calucate the cipher" return cipher 17 if__name__" main_"": 18 plaintext - input()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Apache Cassandra 3 X An Expert Guide To Improving Database Scalability And Availability Without Compromising Performance

Authors: Aaron Ploetz ,Tejaswi Malepati ,Nishant Neeraj

3rd Edition

1789131499, 978-1789131499

More Books

Students also viewed these Databases questions

Question

Explain whether NCI would share in a gain on purchase.

Answered: 1 week ago