Question: 1 . Cyphertext: Encode and Decode 1 . 1 Recall that in Practice Exercises you implemented a cypher text generator, which encrypts a string by

1. Cyphertext: Encode and Decode
1.1 Recall that in Practice Exercises you implemented a cypher text generator, which encrypts a
string by switching every letter at alphabetical position i with the uppercase letter at alphabetical
position 25-i.
In this assignment, you are asked to reimplement it using a function:
Function: cypher(s)
Input: s, a string object
Return: the cypher text corresponding to s
Save the file in ps01_01.py. Test your function by passing it with a meaningful sentence.
Test your function again by passing the string returned by the function from the previous test.
Did you notice that the function can encode as well as decode? Explain why. Use your program
to decode the following: VEVIBLMV HSLFOW GZPV NRHG.6150! What does it say?
1.2 You notice that digits are not encrypted. Improve your program so that any digit at position i
in digits 0-9 is replaced with the digit at 9-i. Save the improved program in ps01_01i.py. What is
the encrypted value of 6150?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!