Program to do the enciphering

Assignment Help Python Programming
Reference no: EM13161456

Write a program to do the enciphering. It should prompt the user for a message, and print out both the entered message and its corresponding ciphertext.

Input. The message to be enciphered. Here is what a correct input should look like (the red text is what you type):

Enter your message: WHENINTHECOURSEOFHUMANEVENTS

Output. The message to be enciphered and the corresponding ciphertext. Here is what the output corresponding to the above input should look like:

plain = "WHENINTHECOURSEOFHUMANEVENTS";
 cipher = "WEITEOREFUAEETHNNHCUSOHMNVNS"

(note the double quotes around the plaintext and ciphertext).

Here is another example. The input is:

Enter your message:  CALLMEISHMAEL

and the corresponding output is:

plain = "CALLMEISHMAEL"; cipher = "CLMIHALALESME"

Now write a program to decipher the messages. Again, it should prompt the user for a ciphertext, and print out both the entered ciphertext and the corresponding plaintext.

Input. The message to be deciphered. Here is what a correct input should look like (the red text is what you type):

Enter your ciphertext: WEITEOREFUAEETHNNHCUSOHMNVNS

Output. The message to be deciphered and the corresponding plaintext. Here is what the output corresponding to the above input should look like:

cipher = "WEITEOREFUAEETHNNHCUSOHMNVNS"; 
plain = "WHENINTHECOURSEOFHUMANEVENTS"

(note the double quotes around the ciphertext and plaintext).

Here is another example. The input is:

Enter your ciphertext: CLMIHALALESME

and the corresponding output is:

cipher = "CLMIHALALESME"; plain = "CALLMEISHMAEL"

Now we will combine the two parts you just did into a single program. This program asks the user to type 'e' to encipher or 'd' to decipher. If the user asks to encipher, the steps in the first part are to be followed; if to decipher, the steps in the second part are to be followed.

Input. Whether the message is plaintext and is to be enciphered, or whether the message is ciphertext and is to be deciphered, followed by the message. Here is what a correct input should look like (the red text is what you type):

e to encrypt, d to decrypt): e
Enter your message: WHENINTHECOURSEOFHUMANEVENTS

Your program must be able to handle either an 'e' (lower case) or 'E' (upper case) to indicate enciphering, and either a 'd' or a 'D' to indicate deciphering.

Output. The entered message and the corresponding ciphertext or plaintext. Here is what the output corresponding to the above input should look like:

plain = "WHENINTHECOURSEOFHUMANEVENTS"; 
cipher = "WEITEOREFUAEETHNNHCUSOHMNVNS"

(note the double quotes around the plaintext and ciphertext).

Here is another example. The input is:

e to encrypt, d to decrypt): D
Enter your ciphertext: CLMIHALALESME

and the corresponding output is:

cipher = "CLMIHALALESME"; plain = "CALLMEISHMAEL"

Reference no: EM13161456

Questions Cloud

Stores a series of numbers in a binary tree. : Queue Converter, Write a program that stores a series of numbers in a binary tree. Then have the program insert the values into a queue in ascending order. Dequeue the values and display them on the screen to confirm that they were stored in the prop..
Describe two independent methods to find out the atomic mass : Describe two independent methods for determining the atomic mass of an element. Explain how these method are truly independent.
Program that reads in the average monthly : Write a program that reads in the average monthly rainfall for a city for each month of the year and then reads in the actual monthly rainfall for each of the previous 12 months. The program then prints out a nicely formatted table showing the rainfa..
Write a c function void print_triangle(int n) : Write a C function void print_triangle(int n) that prints a triangular pattern of asterisks of height n and width 2 * n + 1 with one asterisk in the first line, three in the second line, etc.,
Program to do the enciphering : Write a program to do the enciphering. It should prompt the user for a message, and print out both the entered message and its corresponding ciphertext.
Evaluate the ph during the titration : Calculate the pH during the titration of 100.0 mL of 0.200 M HCl with 0.400 M NaOH. First what is the initial pH (before any NaOH is added
How genotype and phenotype are determined in normal : Explain why phenotype of the cloned mammoth would be similar to the wooly mammoth and not to the elephant egg donor or surrogate elephant mother. Compare and contrast how genotype and phenotype are determined in normal sexual reproduction with how..
Pass in the number of gallons on board : public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.
What are the highest and lowest payments : What are the highest and lowest payments from the writer that the bookkeeper farmer team will accept for the 6th day?

Reviews

Write a Review

Python Programming Questions & Answers

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Define a function to calculate the values

Be sure to define a function to calculate the values and print the table displaying the interest rate in the first column, the monthly payment in the second column, and the total payment in the third column. Your program should not allow the user to ..

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design a function that accepts an integer

Design a function that accepts an integer argument and returns the sum of all the integers from 1 up to the number passed as an argument. For example, if 50 is passed as an argument, the function will return the sum of 1, 2, 3, 4, . . . 50. Use recur..

  Code for the haunted house game

Improve the game by adding more features, for example you can examine more items, more props etc. You may implement this using more lists regarding items and props, remember, you should check if the object is being carried or in the location of th..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd