Answer:
I have got a sample code for your problem you can use it if you want .
def encrypt(texts,s):
result = ""
for i in range(len(texts)):
char = texts[i]
if (char.isupper()):
result += chr((ord(char) + s-65) % 26 + 65)
else:
result += chr((ord(char) + s - 97) % 26 + 97)
return result
texts = "WALLSTREET"
s = 4
print ("Text : " + texts)
print ("Shift : " + str(s))
print ("Cipher: " + encrypt(texts,s))
Its Output is:
Text : WALLSTREET
Shift : 4
Cipher: AEPPWXVIIX
To decrypt:
Cipher(n) = De-cipher(26-n)
Hope you may be able to understand the code if not fell free to ask me anything you want to know about this code.
Happy coding.