Skip to content

Commit

Permalink
finished after pranav helped
Browse files Browse the repository at this point in the history
  • Loading branch information
j605 committed Oct 7, 2011
1 parent 9b1b6f6 commit 76e17fd
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions rot13.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
letters = ['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']
def rotate_word(word,n):
l = ""
for letter in word:
rot = ord(letter) + n
if rot > ord('z'):
rot = rot % ord('a') - 27

elif rot < ord('a'):
rot = rot % ord('a') - 97

else:
rot = rot % ord('a')


#print rot
l = l + letters[(+rot)%26]
rot = 0
return l
#print letters[ord('m') % 97]
print rotate_word("ceaser",13)

0 comments on commit 76e17fd

Please sign in to comment.