Question: Please use python You must complete six (6) functions in this lab. You must write your code in each of these functions so that

Please use python

"""

You must complete six (6) functions in this lab. You must write your code in

each of these functions so that they perform as required. The details of these

functions are provided as comments in the definitions. READ THE INSTRUCTIONS

VERY CAREFULLY!!

Each function has a set of dummy return values that are there so the program

can run without any actual code written. You must replace these return values

with the appropriate ones from your code. The dummy values are also an

indication of the data types to be returned.

You are NOT allowed to import any other modules.

"""

def read_input():

"""

Read input should prompt the user for a message and read and input.

The function should then return three (3) variables:

1. A string/character for mode

2. A string with the key

3. A string with the message

Multiple variables can be returned by separating the variables with a

comma as demonstrated by the dummy return values.

"""

return "E", "175", "MESSAGE TO BE ENCRYPTED"

def caesarEncrypt(word, shift):

"""

Function should take a word and a shift and return the encrypted message

produced using the Caesar Cipher with the word and shift.

Parameter: word - a string of alphabet characters

Parameter: shift - the shift distance

Return: the encrypted string

"""

return "ENCRYPTED"

def caesarDecrypt(word, shift):

"""

Function should take a word and a shift and return the decrypted message

produced using the Caesar Cipher with the word and shift.

Parameter: word - a string of alphabet characters

Parameter: shift - the shift distance

Return: the decrypted string

"""

return "DECRYPTED"

def encrypt(message, key):

"""

This function will take a whole message and a key and encrypt the message

using the key.

Parameter: message - a string, the whole message to be encrypted

Parameter: key - a string, the encryption key

Return: the encrypted message

"""

return "ENCRYPTED MESSAGE"

def decrypt(message, key):

"""

This function will take a whole message and a key and decrypt the message

using the key.

Parameter: message - a string, the whole message to be decrypted

Parameter: key - a string, the encryption key

Return: the decrypted message

"""

return "DECRYPTED MESSAGE"

if __name__ == "__main__":

mode, key, message = read_input()

if mode == "E" or mode == "e":

print(encrypt(message, key))

elif mode == 'D' or mode == 'd':

print(decrypt(message, key))

else:

print("Invalid mode entered.")

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!