Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Python 3.7 alphabetABCDEFGHIJKLMNOPQRSTUVWXYZ ## encode and decode functions using string operations-write here what you did def encode_string (codestring, plaintext): pass def decode_string (codestring, ciphertext)

Use Python 3.7

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

alphabetABCDEFGHIJKLMNOPQRSTUVWXYZ ## encode and decode functions using string operations-write here what you did def encode_string (codestring, plaintext): pass def decode_string (codestring, ciphertext) pass ## encode and decode functions using lists def create_elist (codestring) def create_dlist (codestring) def encode_list (e_list, plaintext) def decode list (d list, ciphertext): pass pass pass pass ## 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 Ero cipher inport class TestCipher (unittest. TestCase) ## test string operation def testdecodestring (self) codest ring . self. assertEqual (decode etring (codestring, CDE BCD) self. assertEqual (decode string (codestrine ZIAB) YYYZA self. assertNotEqual (decode atring (codestring, ABC ABC def testdecodestringwithextras (self) codestrineJMECYEKLFDGUVVHINXRTOSPZQA-) elf. assertEqal (decode atring codestring. JNB. -CY self.assertEqual(decode- tring (codestring.----APS#$! self. assertEqual (decode string (codestring, 1234567...1234567...) def testdecodestringwithlovercase (self) codestringJMBCTERLFDGUNWHINXMRTOSPTQA-) self. assertEqal (decode string (codestring, b y:" self.assertEqual(decode-string (codest ring,Apsti!") ABC, DE def testencodestring (self) self. aszertEqual (encode string (codestring, DEFEG self. assertEqual (encode string (codestring, AAAB BBBC elf. assertNotEqual (encode atring(codestring. ABCABC" def testencodestringwithlovercase (self) elf.assertEqual (encode atrine codestring. "Abc, De self. assertEqual (encode atring(codestring self.assertNotEqual(encode-string (codest ring. APS#$!"). JMB.-CY .---APS#$1.) def testencodestrinewithextras (self) codestringJMECYEKLFDGUVVHINRTOSPTQA- encode tring (codestring, "ABC, DE self. assertEqual (encode string codestring self. assertEqual (encode string (codestrine 1234567.. APS# $ ! 1234567. def testdecodelist (self) elf.assertEqual (decode_list (create dlist (codestring "CDE, BcD) self. assertEqual (decode_list (create dlist (codestrin. ZZAB YTYZA self. assertHotEqual (decode list (create dlist (codestring ABCABC def testdecodelistvithextras (self) codestringJMECYEKLFDGUVWHINXRTOSPZOA) elf. assertEqal (decode list (create dlist (codestring) self.assertEqual(decode-list (create-dlist (codest ring), Equal (decode list (create dlist ( --APS#.) 1234567. 1234567...) def testdecodelistvithlorercase (zelf) codestringJMBCTEKLFDGUNVHINRTOSPIQA ) self. assertEqual (decode list (create dlist (codestrin Mb,-cy: AC, DE self.assertEqual (decode-list (create-dlist (codest ring), v-Aps#8") def testencodelist (self) codestrin2 HIJELMZOPORSTUVWXTEABCDEFG codestrine3-JKORSTUVWXYZABCDEFGLMNOPHI edictl-A edict2 ['a self. assertEqual (create edict (codestring) edict1) elf. aszertEqual (create edict(codestrin2). edict2) self.assertEqual(create-edict (codetring3), edict3) def testcreateddict (self) codestringJMECYEKLFDGUNVHINXRTOSPZQA- codestrig2HITELOPORSTUVWXYZABCDEFG self. assertEqual (create ddiot (codestringl), ddictl) self. assertEqual (create_ddict (codestring2), ddict2) elf. assertEqual (create ddict (codestring3, ddict3) def testdecodedict (self) codestringCDEPG elf. aszertEqual (decode dictionary (create ddict (codestring CDE BCD self. assertEqual (decode dictionary (create ddict (codetring AB)YYA self. assertNotEqual (decode dictionary (create ddict (codestring) ABCABC def testdecodedictvithextras (self) self, asse rtEqual(decode dictionary (create, ddictic destring) .JNBAP 1234567.. ) "ACTR 1234567..) self. assertEqual (decode dictionary create ddict (codestring def testdecodedictvithlowercase (self) codestringJMBCYEKLFDGUVVHINXRTOSPZQA- self. assertEqual (decode dictionary(create ddict (codestring,-cy self. assertEqual (decode_dictionary (ereate ddiet (codestring Ap! ABC, DE def testencodedict (self) codestring- elf. asertEqual (encode dictionary (create edict (codestring DEFEFG self.assertEqual(encode_dictionary (create-edict (codestring), "AAAB.),. 80") self.assertNotEqual(encode_dictionary (create-edict (codestring). ABC") "ABC") def testencodedictvithlcrercase(self) codestringJMECYEKLFDG UVWHINXRTOSPZOA- self. assertEqual (encode dictionary (create edict (codestring Abc. De:). JNB. -C elf.assertEqual (encode-dictionary (create-edict (codetring) self. asserthotEqual (encode dictionary(create edict (codestring) APS#t!") det testencodedictvithextras (self) self. assEqal (encode dictionary(create edict (codestringAC, DE self. assertEqual (encode dictiomary(create edict (codestring eelf. assertEqual (encode_dictionary (ereate edict (codestrg 1234567...). 1234567.. .) unittest.nain) def testencodelist (self) codestringBCDEFGHIJELMNOPORSTUYWXYZA) self. assertEqual (encode list (create eliat (codestrine DEFEFC self.assertEqal (encode list (create elist (codestring). AAAB BBBC) self. asserthotEqual (encode list (create elist (codestring ACABC det testencodelistwithlowercase (self) codestringJECTEKLFDGUNVHINRTOSPTOA self. assrEqal (encode list (create elist (codestring. bc, De:: J-CY self. assertEqual (encode 1ist (create elist (codestring) self. assertHotEqual (encode list (create elist (codestring)- APS#3 ! det tetencodelistvithextras (zelf) self. assertEqual (encode list (ereate elist (codestrin ABC, DE:JMB,-CY self. assertEqual (encodelist (create elist (codestrine). self.assertEqual(encode_11st (create-elist (codestrang). 11234567 APS#3 : 1234567..*) ## test dictionary operation det testcreateedict (self codestringJMECYEKLFDGUNVHINXRTOSPTQA- codestring2ITKLPDOPORS codestrin3 JEORSTUVEXYZABCDEFGLMROPHI EFG- edict2A edict3 PA self. assertEqual (create edict (codeig, edict) self. aszertEqual (create edict (codestring2 edict2) elf. assertEqual (create edict (codestring3) edict3 def testcreateddict (self) codestring JMECYEKLFDGUNWHINKRTOSPZQA- codestring2HIJKLNMOPORSTUVWXYZABCDEFG- codestring3JEQRSTUVWXY GLNNOPHI d dict2 elf. asertEqual (create ddict (codestringl). d dicti) self.assertEqual (create ddict (codestring2). d dict2) self. assertEqual (create ddict (codng3) d dict3) det testdecodedict (self) codestringCDEPGHTJELINOPORSTUVWXY self. assertEqual (decode dictionary(create ddict (codestringCDEBCD ") self. aszertEqual (decode dictionary (create ddict (codestring ZZAB), YYYTA self. assertHotEqual (decode dictionary(create ddict (codestring), A C def tetdecodedictuithext ras (zelf) codestringJMECYEKLFDGUNWHINXRTOSPZQA-) self.assertEqual(decode_dictionary (create_ddict (codestring. TB.-cr self. assertEqual (decode dictionary (create ddict (codestring) self. assertEqual (decode dictionary(create ddict (codestring 1234567. ). 1 234567..") def testdecodedictvithlorercase (eelf) self.assertEqual(decode-dictionary (create-ddict (codest ring. ,,M.-cy. alphabetABCDEFGHIJKLMNOPQRSTUVWXYZ ## encode and decode functions using string operations-write here what you did def encode_string (codestring, plaintext): pass def decode_string (codestring, ciphertext) pass ## encode and decode functions using lists def create_elist (codestring) def create_dlist (codestring) def encode_list (e_list, plaintext) def decode list (d list, ciphertext): pass pass pass pass ## 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 Ero cipher inport class TestCipher (unittest. TestCase) ## test string operation def testdecodestring (self) codest ring . self. assertEqual (decode etring (codestring, CDE BCD) self. assertEqual (decode string (codestrine ZIAB) YYYZA self. assertNotEqual (decode atring (codestring, ABC ABC def testdecodestringwithextras (self) codestrineJMECYEKLFDGUVVHINXRTOSPZQA-) elf. assertEqal (decode atring codestring. JNB. -CY self.assertEqual(decode- tring (codestring.----APS#$! self. assertEqual (decode string (codestring, 1234567...1234567...) def testdecodestringwithlovercase (self) codestringJMBCTERLFDGUNWHINXMRTOSPTQA-) self. assertEqal (decode string (codestring, b y:" self.assertEqual(decode-string (codest ring,Apsti!") ABC, DE def testencodestring (self) self. aszertEqual (encode string (codestring, DEFEG self. assertEqual (encode string (codestring, AAAB BBBC elf. assertNotEqual (encode atring(codestring. ABCABC" def testencodestringwithlovercase (self) elf.assertEqual (encode atrine codestring. "Abc, De self. assertEqual (encode atring(codestring self.assertNotEqual(encode-string (codest ring. APS#$!"). JMB.-CY .---APS#$1.) def testencodestrinewithextras (self) codestringJMECYEKLFDGUVVHINRTOSPTQA- encode tring (codestring, "ABC, DE self. assertEqual (encode string codestring self. assertEqual (encode string (codestrine 1234567.. APS# $ ! 1234567. def testdecodelist (self) elf.assertEqual (decode_list (create dlist (codestring "CDE, BcD) self. assertEqual (decode_list (create dlist (codestrin. ZZAB YTYZA self. assertHotEqual (decode list (create dlist (codestring ABCABC def testdecodelistvithextras (self) codestringJMECYEKLFDGUVWHINXRTOSPZOA) elf. assertEqal (decode list (create dlist (codestring) self.assertEqual(decode-list (create-dlist (codest ring), Equal (decode list (create dlist ( --APS#.) 1234567. 1234567...) def testdecodelistvithlorercase (zelf) codestringJMBCTEKLFDGUNVHINRTOSPIQA ) self. assertEqual (decode list (create dlist (codestrin Mb,-cy: AC, DE self.assertEqual (decode-list (create-dlist (codest ring), v-Aps#8") def testencodelist (self) codestrin2 HIJELMZOPORSTUVWXTEABCDEFG codestrine3-JKORSTUVWXYZABCDEFGLMNOPHI edictl-A edict2 ['a self. assertEqual (create edict (codestring) edict1) elf. aszertEqual (create edict(codestrin2). edict2) self.assertEqual(create-edict (codetring3), edict3) def testcreateddict (self) codestringJMECYEKLFDGUNVHINXRTOSPZQA- codestrig2HITELOPORSTUVWXYZABCDEFG self. assertEqual (create ddiot (codestringl), ddictl) self. assertEqual (create_ddict (codestring2), ddict2) elf. assertEqual (create ddict (codestring3, ddict3) def testdecodedict (self) codestringCDEPG elf. aszertEqual (decode dictionary (create ddict (codestring CDE BCD self. assertEqual (decode dictionary (create ddict (codetring AB)YYA self. assertNotEqual (decode dictionary (create ddict (codestring) ABCABC def testdecodedictvithextras (self) self, asse rtEqual(decode dictionary (create, ddictic destring) .JNBAP 1234567.. ) "ACTR 1234567..) self. assertEqual (decode dictionary create ddict (codestring def testdecodedictvithlowercase (self) codestringJMBCYEKLFDGUVVHINXRTOSPZQA- self. assertEqual (decode dictionary(create ddict (codestring,-cy self. assertEqual (decode_dictionary (ereate ddiet (codestring Ap! ABC, DE def testencodedict (self) codestring- elf. asertEqual (encode dictionary (create edict (codestring DEFEFG self.assertEqual(encode_dictionary (create-edict (codestring), "AAAB.),. 80") self.assertNotEqual(encode_dictionary (create-edict (codestring). ABC") "ABC") def testencodedictvithlcrercase(self) codestringJMECYEKLFDG UVWHINXRTOSPZOA- self. assertEqual (encode dictionary (create edict (codestring Abc. De:). JNB. -C elf.assertEqual (encode-dictionary (create-edict (codetring) self. asserthotEqual (encode dictionary(create edict (codestring) APS#t!") det testencodedictvithextras (self) self. assEqal (encode dictionary(create edict (codestringAC, DE self. assertEqual (encode dictiomary(create edict (codestring eelf. assertEqual (encode_dictionary (ereate edict (codestrg 1234567...). 1234567.. .) unittest.nain) def testencodelist (self) codestringBCDEFGHIJELMNOPORSTUYWXYZA) self. assertEqual (encode list (create eliat (codestrine DEFEFC self.assertEqal (encode list (create elist (codestring). AAAB BBBC) self. asserthotEqual (encode list (create elist (codestring ACABC det testencodelistwithlowercase (self) codestringJECTEKLFDGUNVHINRTOSPTOA self. assrEqal (encode list (create elist (codestring. bc, De:: J-CY self. assertEqual (encode 1ist (create elist (codestring) self. assertHotEqual (encode list (create elist (codestring)- APS#3 ! det tetencodelistvithextras (zelf) self. assertEqual (encode list (ereate elist (codestrin ABC, DE:JMB,-CY self. assertEqual (encodelist (create elist (codestrine). self.assertEqual(encode_11st (create-elist (codestrang). 11234567 APS#3 : 1234567..*) ## test dictionary operation det testcreateedict (self codestringJMECYEKLFDGUNVHINXRTOSPTQA- codestring2ITKLPDOPORS codestrin3 JEORSTUVEXYZABCDEFGLMROPHI EFG- edict2A edict3 PA self. assertEqual (create edict (codeig, edict) self. aszertEqual (create edict (codestring2 edict2) elf. assertEqual (create edict (codestring3) edict3 def testcreateddict (self) codestring JMECYEKLFDGUNWHINKRTOSPZQA- codestring2HIJKLNMOPORSTUVWXYZABCDEFG- codestring3JEQRSTUVWXY GLNNOPHI d dict2 elf. asertEqual (create ddict (codestringl). d dicti) self.assertEqual (create ddict (codestring2). d dict2) self. assertEqual (create ddict (codng3) d dict3) det testdecodedict (self) codestringCDEPGHTJELINOPORSTUVWXY self. assertEqual (decode dictionary(create ddict (codestringCDEBCD ") self. aszertEqual (decode dictionary (create ddict (codestring ZZAB), YYYTA self. assertHotEqual (decode dictionary(create ddict (codestring), A C def tetdecodedictuithext ras (zelf) codestringJMECYEKLFDGUNWHINXRTOSPZQA-) self.assertEqual(decode_dictionary (create_ddict (codestring. TB.-cr self. assertEqual (decode dictionary (create ddict (codestring) self. assertEqual (decode dictionary(create ddict (codestring 1234567. ). 1 234567..") def testdecodedictvithlorercase (eelf) self.assertEqual(decode-dictionary (create-ddict (codest ring. ,,M.-cy

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions