Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PYTHON CODE HELP PLEASE!! restrictions: May not import other modules or use cont

ID: 3716051 • Letter: P

Question

PYTHON CODE HELP PLEASE!!

restrictions: May not import other modules or use contains(), index(), or try-except.

vigenere_encode(secret, message): This function accepts a secret (string) and a message and returns the encoded message.

Test case:

def test_substitution_encode_01(self): message "apple apple rapple" result - substitution_encode (mapping, message) self.assertEqual("gffelogffelo.gffel", result) def test substitution_encode_02 (self) message = "Sam I am!" result - substitution_encode (mapping, message) self.assertEqual("1Bx5lm", result) def test substitution_encode_03 (self) mapping- 'an:'x', 'ba': 'y','na': 'n', 'a 'g', 'b':'t', 'oa': q, 't!': 'T' message"banana boat!" result - substitution_encode (mapping, message) self.assertEqual("ynntqT", result) def test substitution_encode_04 (self) message "abcdefghijklmnopqrstuvwxyz!! ! !abcdefghijklmnopqrstuvwxyz!!!!" result = substitution encode (mapping, message) self.assertEqual("123456123456", result) def test substitution_encode_05 (self) mapping = { . 123 !':' good', 'iti 's ·: 'easy', 'as ea': 'tall', .sy as': 'blue', } message "itl's as easy as 123!" result - substitution_encode (mapping, message) self.assertEqual("easytallbluegood, result) def test substitution_encode_06 (self) mapping- [ 'a': 'a', 'b''b', 'c':'c',h message = "aabbccabccbaaacbb" result - substitution_encode (mapping, message)

Explanation / Answer

ANS:-