Write a Python program that reads in a string S and an integer number N and encr
ID: 3765120 • Letter: W
Question
Write a Python program that reads in a string S and an integer number N and encripts S based on N The process of encryption is Step 1: reverse the first N characters of S Step 2: reverse the last N characters of S Note that it is important that the two steps are performed in that order. We will assume that N is smaller than the length of the string S. Examples of encryption: The string "This is a test" with the key N=4 is encrypted to "sihT is a tset" The string "Another example" with the key N=2 is ecnrypted to "nAother exampel"
Explanation / Answer
S = "This is a test"
print S
N = 4
S[1::-1]
print S[1::-1]
print " "
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.