Last active
July 22, 2018 01:21
-
-
Save stevestock/106b12ca6e353843b74d288be972612b to your computer and use it in GitHub Desktop.
caesar.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
def caesar(text, shift): | |
intab = string.ascii_letters | |
outtab = string.ascii_lowercase[shift:] + string.ascii_lowercase[:shift] \ | |
+ string.ascii_uppercase[shift:] + string.ascii_uppercase[:shift] | |
trantab = str.maketrans(intab, outtab) | |
return text.translate(trantab) | |
instr = "Csbjogvdl jt bo ftpufsjd qsphsbnnjoh mbohvbhf opufe gps jut fyusfnf njojnbmjtn. Uif mbohvbhf dpotjtut pg pomz fjhiu tjnqmf dpnnboet boe bo jotusvdujpo qpjoufs. Ju jt eftjhofe up dibmmfohf boe bnvtf qsphsbnnfst, boe xbt opu nbef up cf tvjubcmf gps qsbdujdbm vtf. Ju xbt dsfbufe jo 1993 cz Vscbo Nümmfs. Bozxbzt, uif gmbh jt tufq_ju_vq" | |
for i in range(1,26): | |
print(caesar(instr, i)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment