Rot13

From codewars.com by Edxael  (that’s me)

ROT13 is a simple letter substitution cipher that replaces a letter with the letter 13 letters after it in the alphabet. ROT13 is an example of the Caesar cipher.

Create a function that takes a string and returns the string ciphered with Rot13. If there are numbers or special characters included in the string, they should be returned as they are. Only letters from the latin/english alphabet should be shifted, like in the original Rot13 “implementation”.

Please note that using “encode” in Python is considered cheating.

Example Test

My Solution

Note:  The following code is not written by me, it was created by another user of codewars.com it belongs to the user: “mlabrum” enjoy.

Examples like the one above keeps me humble. I can’t believe that he/she did it in just one line. and I need to admit that I do not understand that code, I really need to study the documentation. it took me a ton of lines. jajajaja I need to keep studing but I will share other solution from other user.

Note:  The following code is not written by me, it was created by another user of codewars.com it belongs to the user: “yms9654” enjoy.

 

 

 



Copyright 2017. All rights reserved.

Posted January 1, 2017 by Edmundo in category "Ruby Examples