mirror of
https://github.com/Xevion/exercism.git
synced 2025-12-06 19:14:59 -06:00
rot cipher, difference of squares exercises
This commit is contained in:
5
python/rotational-cipher/rotational_cipher.py
Normal file
5
python/rotational-cipher/rotational_cipher.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from string import ascii_letters
|
||||
|
||||
def rotate(text, key):
|
||||
key = key % 26
|
||||
return text.translate(str.maketrans(ascii_letters, ascii_letters[key:26] + ascii_letters[:key] + ascii_letters[26+key:] + ascii_letters[26:26 + key]))
|
||||
Reference in New Issue
Block a user