Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the code to get the CORRECT output without making major changes. Thank you. PYTHON The transposition cipher can be generalized to any number of

image text in transcribed

Complete the code to get the CORRECT output without making major changes. Thank you.

PYTHON The transposition cipher can be generalized to any number of rails. Write a function to implement a three-rail fence cipher that takes every third character and puts it on one of the three rails. Test your algorithm with two sample input as shown below. PlainText: ABCDEFGHI CipherText: CFIBEHADG PlainText: JACK IN THE BOX CipherText: CIT XA EOJKNHB Python Drives Melnsane.py - C:/Users/17737/OneDrive/Desktop/Python Drives Melnsane.py (3.8.4) *Python 3.8.4 Shell* File Edit Shell Debug Options Window Help Python 3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:46:45) [MSC v.1924 64 bit (AMA D64)] on win32 Type "help", "copyright", "credits" or "license ()" for more information. File Edit Format Run Options Window Help 1 def encryption (plainText): 2 evenChars="" 3 oddChars="" 4 charCount=0 5 for ch in plaintext: if charCount % 3 == 0: evenChars = evenChars+ch 8 9 else: 10 oddChars = oddChars + ch 11 charCount = charCount + 1 12 cipherText = oddChars + evenChars 13 return cipherText 14 15 plaintext = input ("Enter message: ") 16 cipherText = encryption (plaintext) 17 print ("Encrypted message : ", cipherText) 18 19 20 21 ======= RESTART: C:/Users/17737/OneDrive/Desktop/PythonDrivesMeInsane.py Enter message: ABCDEFGHI Encrypted message : BCEFHIADG >>> >>> >>> Please correct & complete the code to get the correct output. Thank You. 131

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions