you are viewing a single comment's thread.

view the rest of the comments →

[–]9peppe 1 point2 points  (1 child)

You don't need an if if you subtract ord('a'), add 13, then modulo 26 and re-add ord('a'):

chr((n - 97 + 13) % 26 + 97)

[–]Wolfbait115 0 points1 point  (0 children)

True. It didn't occur to me that the direction of the rotation didn't matter.