def decode(code): pass = Test code msg = 'Hello print(f"Plain text message: (msg)") encoded = encode(msg) print(f"Encoded message: (encoded)") decoded = decode(encoded) • Expected output: - Plain text...


def decode(code):<br>pass<br>= Test code<br>msg = 'Hello<br>print(f

Extracted text: def decode(code): pass = Test code msg = 'Hello print(f"Plain text message: (msg)") encoded = encode(msg) print(f"Encoded message: (encoded)") decoded = decode(encoded) • Expected output: - Plain text message: Hello = Encoded message: HbeklqIRon - Decoded message: Hello print(f'Decoded message: {decoded)}")
Write functions to encode and decode a plain text message with the algorithm below:<br>• The encode) function takes the original, plain text message as input, takes each of its character out and adds one random ASCII letter after it, making each one letter into two letters, and then append the two<br>letters to the new encoded string output.<br>• The decode) function takes an encoded message as input and decodes the messages by removing the random letters added during the encoding process. It only retains characters in the original message. The<br>output of the decode) function will be exactly the same as the original, plain text message.<br>Example<br>• Original message: Hello<br>• Encoded message: HbeklqIRon<br>• Decoded message: Hello<br>Note: the randomLetter) function is given to generate a random ASCII letter.<br>import string<br>import random<br>def randomLetter0:<br>return random.choice(string.ascii_letters)<br>def encode(message):<br>pass<br>def decode(code):<br>pass<br># Test code<br>msg = 'Hello'<br>print(f

Extracted text: Write functions to encode and decode a plain text message with the algorithm below: • The encode) function takes the original, plain text message as input, takes each of its character out and adds one random ASCII letter after it, making each one letter into two letters, and then append the two letters to the new encoded string output. • The decode) function takes an encoded message as input and decodes the messages by removing the random letters added during the encoding process. It only retains characters in the original message. The output of the decode) function will be exactly the same as the original, plain text message. Example • Original message: Hello • Encoded message: HbeklqIRon • Decoded message: Hello Note: the randomLetter) function is given to generate a random ASCII letter. import string import random def randomLetter0: return random.choice(string.ascii_letters) def encode(message): pass def decode(code): pass # Test code msg = 'Hello' print(f"Plain text message: (msg)")

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here