Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a python function called getencryptedstrings, which returns a list of strings that can be decrypted by your Assignment 8 program. Assignment 8 code: a)

Write a python function called getencryptedstrings, which returns a list of strings that can be decrypted by your Assignment 8 program.

Assignment 8 code:

image text in transcribed

a) You can either hardcode the strings from Assignment 8, or prompt the user to enter several phrases and do the encryption yourself, if you have an encryption function. The key point is that you have a function, with the right name, that returns a list of strings.

b) Modify assignment 8 program to call getencryptedstrings(), and then generate a table of decryptions for each one of them.

c) Once you have finished (b), put your function in a different file named encryption.py. This file must be in the same folder as the program for assignment 9. You will then have to make two changes to your assignment 9 program:

1) At the top of the file, add the statement

 import encryption 

2) Use

 encryption.getencryptedstrings() 

as your function call. That should be all there is to do.

Assignment 8.py-C:\Users\m1n00\Desktop\Assignment 8.py (3.6.2) File Edit Format Run Options Window Help This program decrypts already given transposition ciphers (strings). def main () # constant variables first= "S edtiahzyee" second="Bytnoeohg ueest ehwwt e e 10h sraichltnhd at " fourth = "Ih vntywendee ometi i gut rhoyreostn c eal rncheiam vielf" fifth "Srcsa nda . o treo Ishtu klgey" new "" print ("n \t Decrypted message") for n in range (1, 20) : # print 19 strings for c in range (len(second)): # loop to decrypt new += second [1] # building a new string i+= n while i > len(second) -1: # reset when reaching the end of the string i-= len (second) # reset index print (n, '\t', new) if "the" in new: position - n new "" # reset string print ("The decrypted message is ", position) # postion of correct decrypted message main () Assignment 8.py-C:\Users\m1n00\Desktop\Assignment 8.py (3.6.2) File Edit Format Run Options Window Help This program decrypts already given transposition ciphers (strings). def main () # constant variables first= "S edtiahzyee" second="Bytnoeohg ueest ehwwt e e 10h sraichltnhd at " fourth = "Ih vntywendee ometi i gut rhoyreostn c eal rncheiam vielf" fifth "Srcsa nda . o treo Ishtu klgey" new "" print ("n \t Decrypted message") for n in range (1, 20) : # print 19 strings for c in range (len(second)): # loop to decrypt new += second [1] # building a new string i+= n while i > len(second) -1: # reset when reaching the end of the string i-= len (second) # reset index print (n, '\t', new) if "the" in new: position - n new "" # reset string print ("The decrypted message is ", position) # postion of correct decrypted message main ()

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

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions