2024-11-03 00:01:58
2024-11-03 00:00:51
base = ord('a')
CHARLIST = [chr(base+i) for i in range(26)]
def charoff(ch, k):
if ch == ' ':
return ch
pos = CHARLIST.index(ch.lower())
return CHARLIST[(pos + k) % 26]
def caesar(orgstr, k):
return ''.join([charoff(ch, k) for ch in orgstr])
print caesar('meet me after the toga party', 3)