Skip to content

Commit 43bef15

Browse files
author
anastomose
committed
rot13 using translate method
1 parent 1168e5e commit 43bef15

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎Students/ebuer/session_03/rot13.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#create a function that encodes/decodes rot13
2+
3+
import string as s
4+
5+
inkey = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
6+
outkey = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'
7+
complete_key = s.maketrans(inkey, outkey)
8+
9+
test_phrase = 'Zntargvp sebz bhgfvqr arne pbeare'
10+
print test_phrase.translate(complete_key)
11+
12+

0 commit comments

Comments
 (0)