Question
So confused !!!! need help !!!!!! quick !!!!!! Write the functions encrypt(message, key) and decrypt(message, key), where message is a string and key is a
So confused !!!! need help !!!!!! quick !!!!!!
Write the functions encrypt(message, key) and decrypt(message, key), where message is a string and key is a positive integer. Both functions return a string that contains messageencrypted/decrypted using the Caesar cipher method. If a string is not provided as an input for message or an integer is not provided for key, the function must return a string with an error message
-
Functions must encrypt/decrypt both uppercase and lowercase letters
-
decrypt(message, key) retrieves the original message encrypted by the encrypt function if
the same key is used
-
Numbers and punctuation can remain the same
[4 pts] Write the unittest script to perform your testing for both functions encrypt and decryptusing the unittest module and prove that they work properly. Remember to be as descriptive as possible and write as many cases as necessary (check the Hands On video for example of a description). Unittest is intended to run test cases in bulk, so it should contain enough test cases to prove your code works. Discuss possible edge cases during your recitation. Do not include the doctest cases
Deliverables:
-
Submit your encrypt and decrypt code in a file named LAB4.py to the Lab4 GradeScope
assignment before the due date
-
Submit your unittest code in a file named test.py to the Lab4 CANVAS assignment before
the due date
Notes: One of the purposes of unit testing is to provide evidence that everything was tested and it works properly. Feedback will be provided if your code does not work according to the assignment requirements, but no partial credit will be given. You can usehttps://www.braingle.com/brainteasers/codes/caesar.php#form to create test cases
def encrypt (message, key): >> encrypt ("Hello world",12) Tqxxa iadxp' >>> encrypt (''We are Penn State!!!", 6) >>> encrypt("We are Penn State!!!",5) >>>encrypt (5.6,3) error' >>encrypt ('Hello',3.5) 'error' >>>encrypt (5.6,3.15) 'error' 11 TI I YOU CODE STARTS HERE def decrypt (message, key): I1 TI T >>> decrypt ("Tqxxa iadxp",12) 'Hello world' 'We are Penn State!!!' >>> decrypt ("Bj fwj Ujss Xyfyj! !!", 5) 'We are Penn State!!!' >>decrypt (5.6, 3) error >>> decrypt('Hello', 3.5) 'error' >>> de error' crypt (5.6,3.15) 11 1 TStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started