Caesar Cipher

  • + 0 comments

    single line python

    return "".join(
            [chr((ord(ch) - 97 + k) % 26 + 97) if ord(ch) >= 97 and ord(ch) <= 122 else
            chr((ord(ch) - 65 + k) % 26 + 65) if ord(ch) >= 65 and ord(ch) <= 90 else
            ch for ch in s]
        )