Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Caesar Cipher (encryptor) by j-hartshorn
import string
def encrypt_character(c: str, delta: int) -> str:
if c in string.ascii_lowercase:
return string.ascii_lowercase[(string.ascii_lowercase.index(c) + delta) % 26]
else:
return c
def to_encrypt(text: str, delta: int) -> str:
return "".join([encrypt_character(c, delta) for c in text])
Sept. 11, 2018
Comments: