Last active
November 21, 2015 09:16
-
-
Save snapfast/e670220b46fce30ac4c7 to your computer and use it in GitHub Desktop.
Rot 7 program in pyhton
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
__author__ = 'Rahul Bali' | |
import string | |
from itertools import cycle | |
a = input() | |
i = 0 | |
rot7="" | |
b = list(string.ascii_lowercase) | |
while i < len(a): | |
pos = 0 | |
alpha=a[i] | |
if(alpha!=" "): | |
pos = b.index(alpha) | |
rotkey=pos+7 | |
if(rotkey>25): | |
rotkey-=26 | |
final=b[rotkey] | |
rot7+=final | |
else: | |
rot7+=alpha | |
i += 1 | |
print(rot7) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment