Shifting Letters
A simple cipher.
Shifting Letters is a free Coding for Kids lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Coding for Kids learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
The Shifting Cipher! ➡️
A famous code shifts every letter forward by a few spots! 🔐 It's called a Caesar cipher, named after an ancient Roman leader.
Remember ord and chr 🔢
ord turns a letter into a number, chr turns it back. We'll use both!
print(ord('A'))
print(chr(66))Shift One Letter ➕
Add to the number to move forward. A + 3 = D!
shifted = chr(ord('A') + 3)
print(shifted)Pick a Shift Number 🔧
Store your secret shift in a variable. This is your KEY! 🗝️
shift = 3
letter = 'H'
print(chr(ord(letter) + shift))Different Shifts 🎚️
Try shifting by 1, then by 5. Bigger shift, bigger change!
print(chr(ord('C') + 1))
print(chr(ord('C') + 5))Shift Back ⬅️
To undo a shift, subtract instead of add!
shift = 3
letter = 'K'
print(chr(ord(letter) - shift))A Helper Function 🛠️
Let's make a little tool that shifts any letter for us!
def shift_one(letter, shift):
return chr(ord(letter) + shift)
print(shift_one('M', 2))Use It Many Times 🔁
Now we can shift lots of letters with our tool!
def shift_one(letter, shift):
return chr(ord(letter) + shift)
print(shift_one('A', 1))
print(shift_one('B', 1))
print(shift_one('C', 1))Loop Through Letters 🔂
A for loop can shift each letter in a word!
word = 'CAT'
shift = 1
for letter in word:
print(chr(ord(letter) + shift))Build the Coded Word 🧩
Glue the shifted letters together into one secret word!
word = 'CAT'
shift = 1
secret = ''
for letter in word:
secret += chr(ord(letter) + shift)
print(secret)Try Your Name 🪪
Shift your own name into a secret code!
name = 'SAM'
shift = 2
secret = ''
for letter in name:
secret += chr(ord(letter) + shift)
print(secret)Quick Check ✅
To shift a letter FORWARD, what do we do to its number?
Cipher Coder! 🏆
Awesome! You learned to:
- Shift letters with
+and-➡️⬅️ - Use a secret shift key 🗝️
- Make a helper tool 🛠️
- Loop through a whole word 🔂
Next: encode a full message! 📨
Frequently asked questions
Is the “Shifting Letters” lesson free?
Yes — the full text of “Shifting Letters” is free to read here on the web, and the Coding for Kids course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Coding for Kids course, upgrade to CoddyKit PRO.
What will I learn in “Shifting Letters”?
A simple cipher. You practise Coding for Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Coding for Kids?
No prior experience is required. Coding for Kids on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Shifting Letters” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Coding for Kids lesson?
Yes. Every Coding for Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What Is a Code?
- Shifting Letters
- Encoding a Message
- Decoding a Message