Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

%%%%%% PYthon %%%% Need DOC STRING %%%%%%%% Background The Caesar cipher is a simple encryption technique where letters are shifted to other letters in the

%%%%%% PYthon %%%% Need DOC STRING %%%%%%%%

image text in transcribed

Background The Caesar cipher is a simple encryption technique where letters are "shifted" to other letters in the alphabet by some predetermined number of letters. For example, with a shift of 1, the string "abc" would become "bcd". With a shift of -1, the same string would become "zab". See the Wikipedia page (linked to above) for more information about the cipher Instructions For this assignment you will upload an original Python script that satisfies the following specifications the script should contain a function called caesar o the function should take two arguments, in the following order a string to be encrypted ' the amount by which to shift the alphabet (should be an integer; may be positive, negative, or " zero) a shift of 1 means that "a" in the source text should become "b" in the encrypted text a shift of 0 means that "a" in the source text should remain "a" in the encrypted text - - - a shift of -1 means that "a" in the source text should become "z" in the encrypted text the function should replace all lower-case English alphabet letters in the provided string (the first argument) according to the shift specified by the second argument the function should preserve all other characters (upper-case letters, punctuation, letters with diacritics, letters in other scripts, etc.) the function should return the encoded string o o o the script should take two command line arguments, in the following order a string to be encrypted the amount by which to shift the alphabet, following the same conventions as specified for the second argument to the caesar function o o the script should call the caesar function using the command-line arguments and print the result of the function to the console (i.e., stdout) e in addition to Python's built-in functionality, you are allowed to use the following Python packages: argparse, sys. All other Python packages are disallowed for this assignment. (Use of argparse is totally optional.) the script should adhere to the Style guide Hints I suggest you loop over the source string and build up a new string one character at a time. You may want to create a string containing all the lower-case letters of the English alphabet, in order The in operator is your friend. The find() method of strings is your friend. . The % operator (modulo) is your friend Tests String to encrypt abcde How quickly daft jumping zebras vex. My ex pub quiz crowd gave joyful thanks. String that should be returned abcde Hyg aesmuvi nkpd tewzsxq jolbkc oh Mr xq inu jnbs vkhpw ztox chryne matgdl Shift 10 7

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

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

2) Why must an auditor assess materiality?

Answered: 1 week ago

Question

describe the main employment rights as stated in the law

Answered: 1 week ago