Question: Hi, Can someone please help me out with this code? I will show the code I have so far, but I am confused on the

Hi,
Can someone please help me out with this code? I will show the code I have so far, but I am confused on the part where I ask the user to decrypt or encrypt the code and also how do I make it so if the user inputs the code in lower case that it encrypts it in all caps?
 Hi, Can someone please help me out with this code? I
will show the code I have so far, but I am confused
on the part where I ask the user to decrypt or encrypt

Project1 CS 113 The Power and Beauty of Computing This is an open book assignment and you are welcome to ask for assistance from the instructor. Remember to comment your code as necessary and be sure that your submitted code can pass the test cases (input/output pairs) in the sample. Folkow the submission guidelines below Please submit your work to Canvas by 11:59 pm on March 3rd, 2019 1. BACKGROUND The Caesar cipher (http/en.wikipedia.org/wiki Caesar cipher) is one of the oldest and simplest ciphers. It is a type of substitution cipher in which each letter in the plaintext is shifted a certain mber of places, k (called the key). For example, with a shift of 3, 'A, s replaced by "D,, B" is replaced by 'E". and so on. At the end of the alphabet, W" is replaced by 'A', 'Y, is replaced by . B,, and 'Z, is replaced by "C" BCDEFGHIJKLMNOPORS UVWXY ABCDEEGHIJKLMNOPORSTUVWXYZABC If we simply igoreon-alphabetic characters (like spaces, periods, commas, ete...), then, for example, the plaintext EAGLES VICTORY* is encrypted to the ciphertext "HDJOHV YLFWRUB" with a k 3 To implement the cipher in Python we can associate an integer with each character: 'A, with O,B, with 1, ..-, 'Y, with 24 and ' z' with 25 (Note that we are not associating characters with numbers by using the ASCII code.) W implement the cipher by adding k to cach character value and redcing modulo 26. Reconsider the exampe above. Plaintext characterS: 'E AG 'LE S Plaintext code: 0 611 1821 8219 14 17 24 Key (repeated): Ciphertext code 9 14 21 11 22 17 20 If the plaintext is the sequence of characters popPz.P-2Pn-1 and the corresponding ciphertext is the sequence of characters 6-2- + k mod 26, i-0.1.2. . . . , n-1. To decrypt the ciphertext and reoover the plaintext, the receiver of the message compates 2. AssIGNMENT Write a Python program titled CaesarCipher-py thhat prompts the user to enter some text and a key. It should then ask whether the user wants to enerypt or decrypt the given text. Your program will then compute and print the resulting plaintext/ciphertext to the Console. Your code shoukd convert all lower case letters to upper case and simply ignore any nonalphabetic eharacters. See the sample oatput below Please include a header comment indicating the class, the author (you), your email address, the date, and a brie description of the program 3. SAMPLE OUTPUT Enter text: I find that the harder I vork, the sore luck I seen to have. Thomas Jefferson Enter the key: 12 Decrypt (O) or encrypt (1? 1 Enter text: H HK WH GHM. MAXKX BL GH MKR RNT Enter the key: 19 Decrypt ( or encrypt (1)7 Plaintext DO, OR DO NOT. THERE IS NO 'TRY TODA GRADING Grading will be based on the following. Category Coade proverly cacypts tet Weight 30% Code properly decrypts text Code couverts kwer cae to upper case Code contains the proper header Output format exactly matches 10% 10% 10% the format in the examples above Coding style and comments 10% 100% Total: Lab1.pyProject1.py 1 Class: CS 113 A # Author: Zach Martin, martinz1@etown.edu # Created: Feb 26, 2019 4 Description: Program involving Ceaser Cipher # Input: Decrypting the message the user entered # Output: Print out the message the user entered 8 def main(string, shift): 1e 11 for char in string: 12 13 14 15 16 17 18 19 20 21 text input( Enter text:") 22 int (input("Enter the key: )) 23 print("Ciphertext: main(text, s)) cipher if char elif char.isupper): else: cipher cipher char cipher . cipher + chr((ord(char) + shift . 65) % 26 65) cipher . cipher + chr((ord(char) + shift . 97) % 26 + 97) return cipher 25 main() Search Stack Data earch: Case sensitiveWhole words In Selection

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!