Question: def encrypt(message, key): Takes a string and an integer an returns the encrypted message using the Caesar cipher method >>> encrypt(Hello world,12) 'Tqxxa iadxp'

 def encrypt(message, key): """ Takes a string and an integer an
def encrypt(message, key):
"""
Takes a string and an integer an returns the encrypted message using the Caesar cipher method
>>> encrypt("Hello world",12)
'Tqxxa iadxp'
>>> encrypt("We are Penn State!!!",6)
'Ck gxk Vktt Yzgzk!!!'
>>> encrypt("We are Penn State!!!",5)
'Bj fwj Ujss Xyfyj!!!'
>>> encrypt(5.6,3)
'Invalid input'
>>> encrypt('Hello',3.5)
'Invalid input'
>>> encrypt(5.6,3.15)
'Invalid input'
"""
# --- YOU CODE STARTS HERE
# --- CODE ENDS HERE
def decrypt(message, key):
"""
Takes a string and an integer an returns the decrypted message using the Caesar cipher method
>>> decrypt("Tqxxa iadxp",12)
'Hello world'
>>> decrypt("Ck gxk Vktt Yzgzk!!!",6)
'We are Penn State!!!'
>>> decrypt("Bj fwj Ujss Xyfyj!!!",5)
'We are Penn State!!!'
>>> decrypt(5.6,3)
'Invalid input'
>>> decrypt('Hello',3.5)
'Invalid input'
>>> decrypt(5.6,3.15)
'Invalid input'
"""
# --- YOU CODE STARTS HERE
# --- CODE ENDS HERE

ab4%20(1).pdf 16 pts] Write the functions encrypt(message, key) and decrypt(message, key), where message is a string and key is an integer. Both functions return a string that contains message encrypted/decrypted using tue 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 an error message 'Invalid mput 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 14 pts] Write the unit test script to perform your testing for both functions encrypt and decryr using the unittest module and prove that they work properly. Remember to be as descriptive as possible and write as many cases as necessary 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 use https://cryptii.comcaesar-cipher to create base cases Deliverables: You must submit the following 2 files to the Lab 4 CANVAS assignment before the due date: Your code in a file named LAB4. test.py that contains the unit test code . Make sure to include both files in your submission La04 (11.pd LA03 (11 py MacBook Air F4 FS F7 F8 F1O

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!