Categories

# Simple Ceaser-Cypher

Some weeks ago i found this website called “Programming Praxis“, where you can find exercices to practice your programming skills. So every week they post a new problem and a possible resolution (it’s better if you only see it after you’ve done yours), and people try to solve and add a comment with their solution which is fun because you can see diferent ways of thinking in diferent languages.

So i will try once in a while (when time isn’t short) to solve some problems and post here my solutions (generally in python, but i will try other languages too). For this first time i have picked an old and simple problem posted in 2009 (here) about the Ceaser-Cypher which is basically an ancient, simple an totally insecure encryption method, where you add 13 to every letter in the sentense (example: “a” + 13  =  “n”) and when it reaches “z” you return to “a” (example: “t” + 13 = “h”).

So here is the function and the answer to their question:

```def ROT13(string):
new_string=""
for i in string:
letter=ord(i)
if (letter>=65 and letter<=90) or (letter>=97 and letter<=122):
if letter<=90 and letter+13>90:
new_string += chr(64+(letter+13-90))
elif letter<=122 and  letter+13>122:
new_string+=chr(96+(letter+13-122))
else:
new_string+=chr(letter+13)
else:
new_string+=i
return new_string
```

Question: What is the meaning of “Cebtenzzvat Cenkvf vf sha!”? 