PYTHON CODE HELP PLEASE restrictions: may not import other modules and use conta
ID: 3715804 • Letter: P
Question
PYTHON CODE HELP PLEASE
restrictions: may not import other modules and use contains(), index(), or try-except.
caesar_encode(shift, message): This function accepts a shift amount (positive or negative) and a message and returns the encoded message.
Test cases:
# caesar-encode() def test_caesar_encode_01(self): shift 1 message "abcde" encoded "bcdef" result caesar_encode (shift, message) self.assertEqual(encoded, result) def test_caesar_encode_02 (self): shift = 1 message "I've got a lovely bunch of coconuts!" encoded "J (wf!hpu!b !mpwfmz!cvodi!pg!dpdpovut" result caesar_encode (shift, message) self.assertEqual(encoded, result) def test_caesar_encode_03 (self): shift =-1 messageabc+++" encodednabk" result caesar_encode (shift, message) self.assertEqual(encoded, result) def test_caesar_encode_04 (self) shift 5 message "I've got a lovely bunch of coconuts!" result caesar_encode (shift, message) self.assertEqual(encoded, result) def test_caesar_encode_05 (self): shift = 32 message "I've got a lovely bunch of coconuts!" encoded-"¡G7&q; (05@"@-076_ : @#6/$)@0"@$0$0/654A" result caesar_encode (shift, message) self.assertEqual(encoded, result) def test_caesar_encode_06(self): shift =-5 message "Once upon a time, long ago and far away, when mice were mice..." result caesar_encode (shift, message) self.assertEqual(encoded, result)