From 9db67b3291e0a7abc375c2da95efa0dc79d2d4aa Mon Sep 17 00:00:00 2001 From: D Vengatesh <cb.en.u4cse16261@cb.students.amrita.edu> Date: Tue, 11 Dec 2018 23:08:56 +0530 Subject: [PATCH] ex2 q9 done --- CSE16261_Ex02_09.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 CSE16261_Ex02_09.py diff --git a/CSE16261_Ex02_09.py b/CSE16261_Ex02_09.py new file mode 100644 index 0000000..c507066 --- /dev/null +++ b/CSE16261_Ex02_09.py @@ -0,0 +1,11 @@ +s=input("Enter the string to be encrypted:") +shift=int(input("Enter the shift amount:")) +s1="" +for i in s : + if i==' ' : + s1=s1+i + elif i.isupper(): + s1=s1+ chr(int(ord(i)+shift-65)%26+65) + else: + s1=s1+chr(int(ord(i)+shift-97)%26+97) +print(s1) -- GitLab