Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

decode.py (20 points: string manipulation)In this last exercise, you are going to read in an external file that contains a coded message and de-code it!

decode.py (20 points: string manipulation)In this last exercise, you are going to read in an external file that contains a coded message and de-code it! Reading the external file is done for you, as with the last exercise. The decoding should be performed with this scheme in mind: When originally coded, each letter was transposed by adding 5 to its ASCII code, except for all lower case letters a, which were not changed. Therefore you have to figure out a way to reverse this process in order to decode. The function that you have to write, decode(lines), takes in a group of strings stored together (as in the last exercise) in an EXTERNAL FILE called message.txt, which contains a coded message that you must decipher. The function then goes through each string (line) in this list, then each character in the line, and does the decoding (on a character-by-character basis). Finally, it has to print out each line it decodes. See the example below (which does not use the file that you will be using): -bash-4.2$ cat message.txt Ymjwj,x%a%qnyyqj%gqahp%xuty%ts%ymj%xzs%ytia~3 Ny,x%ymj%xarj%tqi%ymnsl%ax%~jxyjwia~3 -bash-4.2$ -bash-4.2$ python3 decode.py There's a little black spot on the sun today. It's the same old thing as yesterday. The Linux command cat message.txt means show me whats in the file message.txt. As you see from the example, the file contains garbled (coded) text. The Python program, decode.py, if working properly, prints out the decoded text.

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

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

Find dr/d. 1/2 + r 1/2 = 1

Answered: 1 week ago

Question

2. Explain grades or test results.

Answered: 1 week ago