Question: BlockPy: 4 ) encrypt _ text / decrypt _ text The encrypt _ text function should consume the plaintext message ( a string ) and
BlockPy: encrypttextdecrypttext
The encrypttext function should consume the plaintext message a string and rotationamount an integer and produces a string where the text is encrypted as follows:
Convert the string to a list of integers using ord.
Rotate each integer of the string by rotationamount amount. To rotate a value, use the following formula: rotated originalrotation Hint: use a helper function.
Insert the tilde ASCII value which translates to ~ after every integer less than Hint: Append more than once.
Convert the list of integers back to a string using chr
The decrypttext function should consume the encrypted message a string and rotationamount an integer and produces a string where the text is decrypted as follows:
Convert the string to a list of integers using ord.
Filter the list to remove any occurrence of the value the tilde ~
The integers in the list are rotated rotationamount amount.
Convert the list of integers back to a string using chr
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
