Decipher is a code-reading game. You'll be shown a snippet of real code and asked a question about it โ what it outputs, what's wrong with it, or what's missing.
In ranked mode you have 3 lives and a timer. Answer fast and correctly to earn points and XP.
This training module walks you through the three puzzle types. No timer, no penalty.
Read the code top to bottom, line by line, as if you're the computer running it. Each line executes in order. Track which values get assigned to which variables.
Tip: mentally substitute variable values as you read โ replace x
with its current value each time you see it.
What does this code print?
x = 10
y = 4
result = x - y
print(result)
Functions are named blocks of code you can call (run) by writing their name followed by parentheses. The value inside the parentheses is passed to the function as input.
Tip: when you see a function call like greet("World"), jump to the function
definition, substitute the argument, and follow what it returns.
What does this code print?
def greet(name):
return "Hello, " + name + "!"
print(greet("World"))
Fill-in-the-blank puzzles have a _____ where a keyword, operator, or
built-in function should go. Use context clues โ the comment often tells you
what the result should be.
Tip: read the comment first. Work backwards โ if the output should be 5
and the list is [3,1,4,1,5], what function gives you the largest value?
What built-in function fills the blank?
nums = [3, 1, 4, 1, 5]
biggest = _____(nums)
print(biggest) # prints 5
Bug puzzles show you code that doesn't work as intended. Your job is to trace what it actually does โ not what it should do. Follow every line exactly as written, even if it looks wrong.
Tip: run the broken code in your head step by step. Bugs often produce an output โ just not the intended one.
This code has a bug. What does it actually print?
numbers = [1, 2, 3, 4, 5]
total = 0
for n in numbers:
total = n # bug: should be total += n
print(total)
Training Complete
You've learned all three puzzle types. In ranked mode the clock is running โ faster correct answers earn bonus points.
quick reference
- trace โ run the code in your head, find the output
- bug โ find the error or trace the broken output
- fill โ read the comment, work out what's missing
- Wrong answer costs a life in ranked mode โ use practice to warm up
- Combos and streaks multiply your XP