Firehose Weekly fuel for the dev firehose

Rotational Cipher

"""
Implement of the rotational cipher, also sometimes called the Caesar cipher.
"""

def rotate(text: str, key: int) -> str:
    chars = "abcdefghijklmnopqrstuvwxyz"

    new_chars = chars[key:] + chars[:key]
    trans_table = str.maketrans(chars + chars.upper(), new_chars + new_chars.upper())
    return text.translate(trans_table)