Question: Problem 2 Some string operations (45 points) + 5 points of extra credit Rick and Morty have been captured by the galactic federation. They are

Problem 2 Some string operations (45 points) + 5 points of extra credit Rick and Morty have been captured by the galactic federation. They are not being held in adjacent cells but fortunately for our heros a corrupt guard is wiling to pass them messages from each other in exchange for money). In order to not have any culpability should things go wrong, he asks that their messages are encoded so he can have some plausible deniability as to what was happening. Youl take a message a string) lower case it, and shift it around (l would recommend lowercasing your string to only have to worry about one set of letters!!) You'll leave spacing and punctuation intact. Your encryption function will take a string, and an offset. This offset will represent a shift in characters. For example with an offset of positive 3, my string cat would shift to fow For example with an offset of negative 3, my string ca: would shift to "q Of course decryption would simply revert these strings to their original forms Extra credit Knowing that there's a chance that somebody would simply see that leters are being shifted Rick might have had time to coach Morty through a slightly more secure procedure where we now have two offets, representing a consonant and a vowel shift. You can think of this version prior to the extra credit version where they are both equal, but now we can vary them. For example Vowels are: A, E, I, O, and U (Y was too undecisive to be considered a vowel for this assignment) For example with an offset of positive 3 for cononant and vowel shift of negative 1, my string "cat would shift to "fuw For example with an offset of negative 3 for consonant and vowel shift of positive 1, my string "cat would shift to zeq If you do the extra credit version, II test your original functionality by keeping both offsets the same (to reduce the coding you have to do) In [ def encrypt( string-input,offset): output None return(output) In l: def decrypt(string-input , offset): output None return(output) In Extra credit version use below functions def encrypt(string input, offset cons,offset_vowel) output- None return(output) In I def decrypt(string input,offset_ cons,offset_vowe1): output None return(output)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
