Caesar Cipher

easy
Unit 3 · Strings III0/3 to milestone

Implement caesar(text, shift) that shifts each letter by shift positions in the alphabet, wrapping around and preserving case. Other characters are unchanged. Negative shifts and shifts larger than 26 must work.

Also implement crack(ciphertext): try all 26 shifts and return the shift (0–25) that decrypts the text into the version with the most occurrences of the letter e (case-insensitive); ties go to the smallest shift.

#strings#encoding2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Caesar Cipher · TechGradify