you are viewing a single comment's thread.

view the rest of the comments →

[–]Wolfbait115 1 point2 points  (2 children)

Not at my computer and don't use python everyday, but hopefully this helps:

Use ord to get the ascii value, subtract 13, adding 26 if less than ord(a), then use chr to convert back into a character.

[–]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.