Skip to content
Snippets Groups Projects
Commit 448811c4 authored by aslesha's avatar aslesha
Browse files

Add new file

parent 988e3092
Branches
No related tags found
No related merge requests found
Pipeline #187 canceled
def encrypt(text,s):
result = ""
for i in range(len(text)):
char = text[i]
if (char.isupper()):
result += chr((ord(char) + s-65) % 26 + 65)
else:
result += chr((ord(char) + s - 97) % 26 + 97)
return result
text=input("enter the sentence to encrypt: ")
s=int(input("enter the no of shift locations to do: "))
print("given text: "+text)
print("Shift locations: "+str(s))
print("encrypted text: " +encrypt(text,s))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment