Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use python method and easy way to solve this thank you! Question 2 [10 marks]: In this question, you will write a program to encrypt

image text in transcribedimage text in transcribedUse python method and easy way to solve this thank you!

Question 2 [10 marks]: In this question, you will write a program to encrypt and decrypt a string using a simple substitution cipher. In particular, you will start by setting up an alphabet string "abcdefghijklmnopqrstuvwxyz" (note there is a space character at the end of this string) Next, input an offset and a phrase (another string) to be encrypted. The characters in the phrase must be characters from the alphabet that you defined above. The offset indicates how to encrypt each character. In particular, each character will be replaced in the new encrypted string by a character that is "offset" number of characters beyond it in the alphabet. If a character in the input string is "c" and the offset is 2 then the character in the encrypted string will be "e" (which occurs 2 letters later in the alphabet). Note that you need to handle wrap-around at the end of the alphabet. For example, if a character in the input string is "z", then the encrypted character will be "a" if the offset is 2. You can assume that the offset will be less than the number of characters in the alphabet. The encryption problem is divided into three parts. The fourth part is to reverse this process and therefore create a function to decrypt a string. To begin, set up your main program as the following #Main Program alpha - "abcdefghijklmnopqrstuvwxyz" offset-int (input ("Enter the offset: ")) phrase -input ("Enter the phrase to encrypt:")

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

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions

Question

=+What can we learn about the PVA data from this decision tree?

Answered: 1 week ago

Question

Explain the steps involved in training programmes.

Answered: 1 week ago

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

4. Are there any disadvantages?

Answered: 1 week ago

Question

3. What are the main benefits of using more information technology?

Answered: 1 week ago

Question

start to review and develop your employability skills

Answered: 1 week ago