Skip to content

Instantly share code, notes, and snippets.

@snapfast
Last active November 21, 2015 09:16
Show Gist options
  • Save snapfast/e670220b46fce30ac4c7 to your computer and use it in GitHub Desktop.
Save snapfast/e670220b46fce30ac4c7 to your computer and use it in GitHub Desktop.
Rot 7 program in pyhton
__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