Caesar Shift
The Caesar cipher is a simple way to hide text by shifting every letter through the alphabet by the same number of positions. The function caesar_encrypt receives a string text and a shift value shift. Move each Latin letter forward with wraparound at the end of the alphabet, preserve letter case, and leave spaces, punctuation, and other characters unchanged.
Примеры
Ввод
("abc", 1)Вывод
"bcd"Ввод
("xyz", 3)Вывод
"abc"Ввод
("Hello, World!", 3)Вывод
"Khoor, Zruog!"Нужно реализовать
def caesar_encrypt(text: str, shift: int) -> str:
Теги
strings
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
AccediTests12
Visible tests
Test nascosto 7
Test nascosto 8
Test nascosto 9
Test nascosto 10
Test nascosto 11
Test nascosto 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid