Caesar cipher
此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
此任务基于您尚未完成的课程。请先完成以下课程:
Python 基础 · Functions →
凯撒密码
罗马历史学家苏埃托尼乌斯记载,尤利乌斯·凯撒把每个字母在字母表中后移三位来隐藏信息。
alphabet.index(ch) 给出字母的位置:a 是 0,z 是 25。加上移动的位数,再用 % 26,让位置 26 回到 0。要解密,就用 26 减去原来的位数,再移动一次。
难度 4/5 · 今日首次完成可获 280 金币及少量额外奖励
Write caesar(text, shift) that moves every lowercase letter shift places along the alphabet, wrapping from z back to a. Leave every other character as it is. caesar("hello, world", 3) is(是) "khoor, zruog".
点击“运行”查看此处输出。