Question: CODE MUST BE COMPLETED IN PYTHON 3. Here is the starter code to use. Do not change this code, just add to it where necessarry,

 CODE MUST BE COMPLETED IN PYTHON 3. Here is the starter

code to use. Do not change this code, just add to it

CODE MUST BE COMPLETED IN PYTHON 3. Here is the starter code to use. Do not change this code, just add to it where necessarry, also do not use the functions chr() and ord().

"""

Assignment Starter Code """ import string

#This is the plain-text to be encrypted. Do Not delete this! plain_text = """The quick brown fox jumps over the lazy dog."""

#This is the easy secret message for optional decryption easy_secret = """S xgjx llvkek, cmwv wsk hvctxbui - jvvx ar Jfyllsp."""

#This is the Full secret message for optional decryption secret_message = """Gchl kdcey sor fynfb lyssg nag pie zsuvrlk cfboyih sijuv bh liwf wgohvhwoh, n hwx bnnapb, pifdsvpwe wa Facsenq, bbq xwewpulfr gi lis clgqcfcljca nzbh nfd nsa ujf qeysusq yivoy.

Hgx kr ujf saashsq cf b ueysu qvpam knl, lfggcfh kuylise nzbh auljca, ij bbl hsuwbh kp qbhufwiyv bbq mg esqcubhrx, ubb yifh saxmss. Jy sss zyl pb n ajfog vsuhyy-xjsyx gg huul xoe. Qw ioiy upar ng esqcubhr u hpfgcgo cs nzbh scwmr, nm s gwaud ssfnaou cfsds sij uvbmw xvb bwss tunf huyas zvpwt huul uvnn fbhvif nwtbl mwiy. Au wf uductylise zauhvhy bbq jjpdrl liog qw tvbode rb nzvg.

Ool, jb n fssurl kfbfy, of qnh fph qyvjqnnw -- xs puf ocg wgogrwjbhr -- qw doa hgu vnfdpk -- gbat ueimor. Gbw cfnpw nsa, fawwaa sor qyse, kui kufhaymsq bwss, uunf qbhkfqeulfr vn, xbf nvgws boj qcbl hpkrl lp oqx gs rrnjbqg. Nzf kblde kvfd mwgndf bbnw, oce fgou eyefaoyj xvnn of gns zffr, vmu wg wso brpws tblyfh jbsu huyq ewq bwss. Vn at tbl mt huy djjvhy, sogbws, hb vw esqcubhrx zffr ng uvr ofgwackisq qgsy jbadv gbwz kui xpitbl isey zbjr nzvg suj tc aitmm nxnbbpyv. Jh vm jbhuyj gce ok uc oy zffr xwewpulfr gi lis tlwbh gukl frgsjbvhy cssijf if -- nzbh slgn huykf vbhgssq xwbr jy lbyr cfdfrukfr qynphvif uc gbsu qnokf tbl oiwpb lisl asws gbw mofn xvzy gwbghlw pt qynphvif -- uvnn of vrlw iwtbdz frmgmjr nzbh gbwts qyse guudm bbn zbjr xafr vh nbwa -- nzbh gbat bnnapb, hhvff Tiv, tvnfd ioiy s osj vashu ix gfryvpa -- nhv uvnn ypjrlfnsan gg huy hfccfw, cm gbw qsbjdf, tbl lis cygqzr, mzbzy hgu drlatv slgn huy wbfgb."""

def encrypt_letter(text_letter, code_letter): alphabet = string.ascii_uppercase index = alphabet.find(code_letter) cypher = alphabet[index:]+alphabet[:index] index2 = alphabet.find(text_letter.upper()) result = cypher[index2] if text_letter.islower(): result = result.lower() return result

def encrypt(text, code): cypher_text = "" for letter in text: if letter.isalpha(): cypher_text += code[number%???] #need to implement proper values here #code_letter = ? #encrypt_letter(letter,) else: cypher_text += letter return cypher_text

#TO DO: #1. Ask the user for a code word and store it for use later code_word = input("Enter the code word: ") code_word = code_word.upper()

#2. Call an encryption function with the plainText above and the code word and save the result it gives back (cypher-text) cypher_text = encrypt(plain_text, code_word) #3. Print out the cypher-text Objective: Practice using lists with strings, loops, functions, and conditional execution. Description: In this assignment you will create a program that can ask the user to input a code word and then use that word to encrypt a given message using the Vigenre cypher. The Vigenre cypher uses a code word to scramble a plain-text message into an encrypted message Generally, only alphabet characters are encrypted, and non-letters are normally removed. For our purposes, we will simply copy punctuation and spaces from the plain-text to the cypher text only the letters will be encrvpted. Upper-case letters are encrypted to upper-case and lower-case to lower-case. To perform the encryption on some text, each letter in the text is matched with a letter in the secret code. The letter in the secret code determine the offset applied to corresponding letter in the plain-text. Each code letter produces an offset, for example "A" represents an offiset of 0, "B" an offset of 1, "C" an offset of 2 and so on. A letter in plain-text, say "m" is encrypted by a code letter of "A" to "m", by "B" to "n", by "Cto "o and so on. The encryption that offsets a letter past "z" wraps back around to start with "a". Your program must meet the following requirements: 1. Include a multi-line comments at the top of the file with your name, PSID number, and the assignment number. 2. Your program should ask the user for a code word. The code word need not be an actual word, but must be composed of letters. 3. Your program should use a function to encrypt the given text with the specified code word, and then display the resulting cypher-text ONLY 4. Your program should only encrypt the letters in the plain text, non-letters should simply be copied to the cypher-text. Letters should retain their case when encrypted. Hint: Test your code often and ask questions Deadline: Friday October 26, 11:59PM Example Results: For example, the plain text might be A test string, just for practice here in Houston Using the code word: SECRET Would yield a cypher-test that reads: S xgjx 1lvkek, cmww wsk hvctxbui - jvvx ar Jfyl1sp

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!