ord('a')
97
ord('b')
98
ord('A')
65
chr(97)
'a'
def encode(n,s):
result = ""
for c in s:
if c >= 'a' and c <= 'z':
result = result + chr(((ord(c) - ord('a')) + n)%26 + ord('a'))
else:
result = result + c
return result
encode(13,'my name is Raj')
'zl anzr vf Rnw'
chr((ord('a')-ord('a')+13)%26 + ord('a'))
'n'
def encode(n,s):
result = ""
for c in s:
if c >= 'a' and c <= 'z':
result = result + chr(((ord(c) - ord('a')) + n)%26 + ord('a'))
else:
result = result + c
return result