subject

9.12 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 = "I CAME I SAW I CONQUERED" and shift = 3, then cipher = encrypt(plaintext, shift) should return F ZXJB F PXT F ZLKNRBOBA 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 = "I came I saw I conquered" and shift = 3, then cipher = encrypt(plaintext, shift) should return F zxjb F pxt F zlknrboba as the cipher.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:10
Read the code below. what will the computer print if the input for year_variable is 1700? if year_variable == 1776: print("your answer is correct. the declaration of independence was signed in “year_variable”.") elif year_variable < 1776: compute_variable = 1776 - year_variable. print("add “compute_variable“ years to your answer for the correct answer.") elif year_variable > 1776: compute_variable = year_variable - 1776 print("subtract “compute_variable” years from your answer for the correct answer.")
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
question
Computers and Technology, 23.06.2019 22:50
What is an rss reader used for? for creating a user account on a social new site
Answers: 2
question
Computers and Technology, 24.06.2019 01:00
What shows the web address of the page that is currently displayed in the workspace? status window toolbar location bar internet box
Answers: 1
You know the right answer?
9.12 LAB: The Caesar cipher In cryptography, Caesar's cipher is one of the simplest and most widely...
Questions
question
Mathematics, 19.01.2021 14:00
question
Mathematics, 19.01.2021 14:00
question
Spanish, 19.01.2021 14:00
question
Business, 19.01.2021 14:00
question
Physics, 19.01.2021 14:00
question
Mathematics, 19.01.2021 14:00
question
Biology, 19.01.2021 14:00
question
Mathematics, 19.01.2021 14:00
Questions on the website: 13722363