Question
Please use Python for this question. Write a program that encrypts text. The program requires the following user input: (1) the text to encrypt; (2)
Please use Python for this question.
Write a program that encrypts text. The program requires the following user input: (1) the text to encrypt; (2) a positive integer primer. Valid primer values include: 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, and 25; (3) a second positive integer number.
Each letter is shifted to the position n, where n is given by: (primer * position of each letter + number) % 26
For example, if primer = 1, number = 1, 'A' turn to 'B' since (1 * 0[The alphabetic position of 'A'] + 1) = 1[The alphabetic position of 'B']. In general, this setting will shift all alphabets by 1 place.
The program should ignore non-alphabetic characters. Encryption should return shifted alphabetic characters of same case. You can assume primer and number are positive integers.
Here's an example of how your program should work: Enter text: booboo Enter primer: 5 Enter positive integer: 8 naana a Here's another example (when primer is not valid): Enter text: Anything Enter primer:2 Enter positive integer: 3 Primer must be 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 2 And another (handling uppercase characters) Enter text: YELL Enter primer:1 Enter positive integer: 1 ZFMM And another (ioring non-alphalxiiccharxiers): Enter text: Keeping secrets! Enter primer:7 Enter positive integer: 4 Wggfiru agstghaStep 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