Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use Python 3.7 and based on the test code ## encode and decode functions using dictionaries def create_edict (codestring) def create_ddict (codestring): def encode_dictionary (e_dict,
Use Python 3.7 and based on the test code
## encode and decode functions using dictionaries def create_edict (codestring) def create_ddict (codestring): def encode_dictionary (e_dict, plaintext) def decode_dictionary (d dict, ciphertext) pass pass pass pass ## test dictionary operation def testcreateedict (self) codestring JMBCYEELFDGUNVEINKRTOSPZQA- codestring2 edict2 Pa self. assertEqual (create edict (codestring), edict1) elf. assertEqual (create edict (codestring2). edict2) self. assertEqual (create edict (codestring3) edict3) def testcreateddict (self) codestringJMECYEKLFDGUNVHINXRTOSPZOA- codestrig2HITELNOPORSTUVWXTZABCDEFG ddictl ddict2 self. assertEqual (create ddict (codestringl), d dictl self. assertEqual (create_ddiot (codestring2), ddict2) elf. assertEqual (create ddict (codestring3, ddict3) def testdecodedict (self) codest ring-BCDEFGELTSLINOPQRSTUVVXYZA- elf. asertEqual (decode dictionary (create ddict (codestring), CDE BCD self. assertEqual (decode dictionary (create ddict (codetring AB)YYA self. assertNotEqual (decode dictionary (create ddict (codestring ABC. ABC) def testdecodedictvithextras (self) self.asse rtEqual decode, det io ar (create ddict (codestring), , ) "ABIN $ self.assertEqual(decode_dct1onary (create_ddict (codest ring).----APS#$! self. assertEqual (decode_dictionary(create ddict (codesting 1234567..."1234567..) def testdecodedictvithlowercase (self) codest ring" ("JMETEKLFDGUTVHNXRTOSPZQA_*) self. assertEqual (decode dictionary(create ddict (codestring,-cy self. assertEqual (decode dictionary (ereate_ddiet (codestring) def testencodedict (self) self.assertEqual (encode-dictionary (create_edict (codestring). "DEF'), vEFG") self. assertEqual (encode dictionary (create edict (codestring AAAB) BBBC self.assertNotEqual(encode-dictionary (create_cdict (codestring). ABC"), "ABC") def testencodedictvithlcrercase(elf) codestringJMECYEKLFDG UVWHINXRTOSPTOA- self.assertEqual(encode_dictionary (create-edict (codestring. "Abe. self.assertEqual (encode-dictionary (create-edict (codetring) self. asserthotEqual (encode dictionary(create edict (codestring) De :*). TB.-cY APS#$!"), " APS#t!") det testencodedictvithextras (self) codest ring" ("JMRTEKLFDGTWHNXRTOSPZQh-*) self. assrEqal (encode dictionary(create edict (codestringAC, DE self. aszertEqual (encode_dictiomary(create edict (codestring self. assertEqual (encode_dictionary (create edict (codestring). 1234567.. "1234567.) APSAS ## encode and decode functions using dictionaries def create_edict (codestring) def create_ddict (codestring): def encode_dictionary (e_dict, plaintext) def decode_dictionary (d dict, ciphertext) pass pass pass pass ## test dictionary operation def testcreateedict (self) codestring JMBCYEELFDGUNVEINKRTOSPZQA- codestring2 edict2 Pa self. assertEqual (create edict (codestring), edict1) elf. assertEqual (create edict (codestring2). edict2) self. assertEqual (create edict (codestring3) edict3) def testcreateddict (self) codestringJMECYEKLFDGUNVHINXRTOSPZOA- codestrig2HITELNOPORSTUVWXTZABCDEFG ddictl ddict2 self. assertEqual (create ddict (codestringl), d dictl self. assertEqual (create_ddiot (codestring2), ddict2) elf. assertEqual (create ddict (codestring3, ddict3) def testdecodedict (self) codest ring-BCDEFGELTSLINOPQRSTUVVXYZA- elf. asertEqual (decode dictionary (create ddict (codestring), CDE BCD self. assertEqual (decode dictionary (create ddict (codetring AB)YYA self. assertNotEqual (decode dictionary (create ddict (codestring ABC. ABC) def testdecodedictvithextras (self) self.asse rtEqual decode, det io ar (create ddict (codestring), , ) "ABIN $ self.assertEqual(decode_dct1onary (create_ddict (codest ring).----APS#$! self. assertEqual (decode_dictionary(create ddict (codesting 1234567..."1234567..) def testdecodedictvithlowercase (self) codest ring" ("JMETEKLFDGUTVHNXRTOSPZQA_*) self. assertEqual (decode dictionary(create ddict (codestring,-cy self. assertEqual (decode dictionary (ereate_ddiet (codestring) def testencodedict (self) self.assertEqual (encode-dictionary (create_edict (codestring). "DEF'), vEFG") self. assertEqual (encode dictionary (create edict (codestring AAAB) BBBC self.assertNotEqual(encode-dictionary (create_cdict (codestring). ABC"), "ABC") def testencodedictvithlcrercase(elf) codestringJMECYEKLFDG UVWHINXRTOSPTOA- self.assertEqual(encode_dictionary (create-edict (codestring. "Abe. self.assertEqual (encode-dictionary (create-edict (codetring) self. asserthotEqual (encode dictionary(create edict (codestring) De :*). TB.-cY APS#$!"), " APS#t!") det testencodedictvithextras (self) codest ring" ("JMRTEKLFDGTWHNXRTOSPZQh-*) self. assrEqal (encode dictionary(create edict (codestringAC, DE self. aszertEqual (encode_dictiomary(create edict (codestring self. assertEqual (encode_dictionary (create edict (codestring). 1234567.. "1234567.) APSASStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started