Skip to content

Instantly share code, notes, and snippets.

@jah2488
Created June 4, 2010 15:19
Show Gist options
  • Save jah2488/425536 to your computer and use it in GitHub Desktop.
Save jah2488/425536 to your computer and use it in GitHub Desktop.
def abShift ( Words ):
# TODO: Allow '.' and ' ' to be accounted for, shouldn't be too hard.
a = [' ','.','(',')','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
b = []
for letter in Words:
for ch in a:
if letter == ch:
b.append(a.index(ch))
print "index b : ", b
#
#
#
#
print "index a : " , a
print "index b : " , b
c = []
for indices in b:
if indices <= (len(a)-3) and indices >= 4:
indices += 2
c.append(indices)
elif indices >= 28:#(len(a)-2):
indices - 24 #(len(a)-4)
c.append(indices)
else:
c.append(indices)
#
print "index c : " , c
d = []
for value in c:
d.append(a[value])
print "index d : ", d
print " Original : ", Words
print " New : " + " ".join(d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment