Dashboard Temp Share Shortlinks Frames API

HTMLify

encrypt_caesar_cipher.py
Views: 581 | Author: abh
1
2
3
4
5
6
7
8
9
def encrypt_caesar_cipher(text, shift):
    cipher = ""
    for char in text:
        if char.isalpha():
            offset = 65 if char.isupper() else 97
            cipher += chr((ord(char) - offset + shift) % 26 + offset)
        else:
            cipher += char
    return cipher