Skip to content

Instantly share code, notes, and snippets.

View Susros's full-sized avatar
🎯
Focusing

Kelvin Htat Susros

🎯
Focusing
View GitHub Profile
@Susros
Susros / caesar_cipher_decrypt_xy25la.py
Last active February 23, 2024 03:54
caesar_cipher_decrypt_xy25la
# Deciphering the Caesar cipher encoded message with a loop to try different shifts
def caesar_cipher_decrypt(ciphertext, shift):
decrypted_text = ""
for char in ciphertext:
if char.isalpha(): # Check if the character is an alphabet
shift_amount = shift % 26
if char.islower():
decrypted_text += chr((ord(char) - shift_amount - 97) % 26 + 97)
else: