Question: Project Description / Specification 1) The program should prompt the user for one of three commands a) e to encode a string b) d to


Project Description / Specification 1) The program should prompt the user for one of three commands a) "e" to encode a string b) "d" to decode a string c) "q" to quit Any other command should raise an error and reprompt. Accept either upper or lower case letters (Hint: use the string method upper or lower )). Use q' to control your while 2) If the command is encode, then the program prompts for a string to encode and a keyword a) To build the symmetric key, start with an empty string and as you loop through the loop (which consist only of letters). The program then returns the encoded string (cipher text). keyword add characters to the key string (remember to check for duplicates before insertion. Hint: the string in operator is useful and remember that you can also use not as part of a Boolean expression, i.e. not in). Repeat to add the remaining characters in the alphabet. b) Hint: To encode you will find the string index ) or find ) methods useful for finding the index of a character in the alphabet. Important, the program should not encode any letter that is not in the lower-case alphabet. If upper case, then convert it to lower case. Punctuations, special characters and numbers should simply be passed through to the encoded string c) d) The keyword should only contain lower case letters and its length should be between at least 1 and less or equal to 26. If not the case, then the program should display an error message and prompt the user to give another keyword For the affine cipher always use a-5, b-8, and m-26. (Hint: mod is Python's % operator. Also, start with an empty cyphertext and add each encrypted character one at a time to the cyphertext as you encrypt each one.) e) f) Hint: the string isalpha method may be helpful. Also, import string and string.ascii_lowercase might also be useful. 3) If the command is decode, then the program should prompt for a string to decode and a keyword. The output should be the decoded string (plain text) 4) If the command is quit, then the program ends and prints a nice exit message Project Description / Specification 1) The program should prompt the user for one of three commands a) "e" to encode a string b) "d" to decode a string c) "q" to quit Any other command should raise an error and reprompt. Accept either upper or lower case letters (Hint: use the string method upper or lower )). Use q' to control your while 2) If the command is encode, then the program prompts for a string to encode and a keyword a) To build the symmetric key, start with an empty string and as you loop through the loop (which consist only of letters). The program then returns the encoded string (cipher text). keyword add characters to the key string (remember to check for duplicates before insertion. Hint: the string in operator is useful and remember that you can also use not as part of a Boolean expression, i.e. not in). Repeat to add the remaining characters in the alphabet. b) Hint: To encode you will find the string index ) or find ) methods useful for finding the index of a character in the alphabet. Important, the program should not encode any letter that is not in the lower-case alphabet. If upper case, then convert it to lower case. Punctuations, special characters and numbers should simply be passed through to the encoded string c) d) The keyword should only contain lower case letters and its length should be between at least 1 and less or equal to 26. If not the case, then the program should display an error message and prompt the user to give another keyword For the affine cipher always use a-5, b-8, and m-26. (Hint: mod is Python's % operator. Also, start with an empty cyphertext and add each encrypted character one at a time to the cyphertext as you encrypt each one.) e) f) Hint: the string isalpha method may be helpful. Also, import string and string.ascii_lowercase might also be useful. 3) If the command is decode, then the program should prompt for a string to decode and a keyword. The output should be the decoded string (plain text) 4) If the command is quit, then the program ends and prints a nice exit message
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
