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
Logi sisse, et näha esituste ajalugu
Logi sisseLogi sisse, et kasutada AI mentorit
Logi sisseTests12
Visible tests
Peidetud test 7
Peidetud test 8
Peidetud test 9
Peidetud test 10
Peidetud test 11
Peidetud test 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