Answered step by step
Verified Expert Solution
Question
1 Approved Answer
DO NOT ALLOW TO IMPORT ANY INBUILT LIBRARY Write a simple Python program to encrypt and decrypt the user message. Encryption is the method to
DO NOT ALLOW TO IMPORT ANY INBUILT LIBRARY
Write a simple Python program to encrypt and decrypt the user message. Encryption is the method to convert your intelligent message into unintelligent form and decryption is the opposite process. The process of encryption is as follows: If the user enters the message "Stop global warming and the key (k) as 11, then each letter in the user message must be replaced by the letter which is after 11th position from the corresponding letter i.e. each letter is shifted by the amount given in the k forward in the alphabet. Consider a (or A) is 0, b (or B) is 1, c (or C) is 2 and so on. With this, the numerical value for each character in the user message (Stop global warming) is: | Stop 8 Iob a | 18 | 19 | 14 | 15 6 11 14 1 0 warming 220 17 12 8 13 6 11 For the key 11, the shifting will be by an amount 11. So, each character is shifted forward by 11. So, a (or A) becomes I (or L), b (or B) becomes m (or M), ....., p (or P) becomes a (or A), 9 (or Q) becomes b (or B), ..... The above message after applying the shift of k (i.e. 11), you get the encrypted message as: De za rw z mw hCxt yr | 3 | 4 | 250 | 17 | 22 | 25 | 12 | 11 | 22 | 7 | 11 | 2 | 23 | 19 | 24 | 17 | The process of decryption is as follows: Each letter is shifted back by the amount k. So, if the user message is LEWLYPLUJL and the key (k) is 7, then the numerical value for each character is: | LEWLY PLUIJL 11 4 22 1124 | 15 11 20 9 11 For the key 7, the shift amount will be -7. So, each character is shifted backward by 7. So, the above message becomes: Sample Test Data and Sample Output: Please use the menu below to tell what you want to do: 1. Encryption 2. Decryption Please enter your choice: 1 Please enter your message to encrypt: STOP GLOBAL WARMING Please enter the key: 11 The encrypted message is: DEZA RWZMLW HLCXTYR Do you want to exit (y or yes and n for no): n Please enter your choice: 2 Please enter your message to decrypt: LEWLYPLUL PZ H NYLHA ALHJOLY Please enter the key: 7 The decrypted message is: EXPERIENCE IS A GREAT TEACHER Do you want to exit (y or yes and n for no): Y All the text in red is the user input. Write a simple Python program to encrypt and decrypt the user message. Encryption is the method to convert your intelligent message into unintelligent form and decryption is the opposite process. The process of encryption is as follows: If the user enters the message "Stop global warming and the key (k) as 11, then each letter in the user message must be replaced by the letter which is after 11th position from the corresponding letter i.e. each letter is shifted by the amount given in the k forward in the alphabet. Consider a (or A) is 0, b (or B) is 1, c (or C) is 2 and so on. With this, the numerical value for each character in the user message (Stop global warming) is: | Stop 8 Iob a | 18 | 19 | 14 | 15 6 11 14 1 0 warming 220 17 12 8 13 6 11 For the key 11, the shifting will be by an amount 11. So, each character is shifted forward by 11. So, a (or A) becomes I (or L), b (or B) becomes m (or M), ....., p (or P) becomes a (or A), 9 (or Q) becomes b (or B), ..... The above message after applying the shift of k (i.e. 11), you get the encrypted message as: De za rw z mw hCxt yr | 3 | 4 | 250 | 17 | 22 | 25 | 12 | 11 | 22 | 7 | 11 | 2 | 23 | 19 | 24 | 17 | The process of decryption is as follows: Each letter is shifted back by the amount k. So, if the user message is LEWLYPLUJL and the key (k) is 7, then the numerical value for each character is: | LEWLY PLUIJL 11 4 22 1124 | 15 11 20 9 11 For the key 7, the shift amount will be -7. So, each character is shifted backward by 7. So, the above message becomes: Sample Test Data and Sample Output: Please use the menu below to tell what you want to do: 1. Encryption 2. Decryption Please enter your choice: 1 Please enter your message to encrypt: STOP GLOBAL WARMING Please enter the key: 11 The encrypted message is: DEZA RWZMLW HLCXTYR Do you want to exit (y or yes and n for no): n Please enter your choice: 2 Please enter your message to decrypt: LEWLYPLUL PZ H NYLHA ALHJOLY Please enter the key: 7 The decrypted message is: EXPERIENCE IS A GREAT TEACHER Do you want to exit (y or yes and n for no): Y All the text in red is the user inputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started