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 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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
