Python Challenge - Level 23

Problem

The clue in the HTML source is:

<!-- it can't find it. this is an illusion, for amusement only -->
<!-- 'va gur snpr bs jung?' -->

The text 'va gur snpr bs jung?' is encoded with ROT-13. In Python, importing this displays The Zen of Python, which is internally encoded using ROT-13:

>>> import this

Solution

Decoding the ROT-13 cipher text 'va gur snpr bs jung?' yields:

"in the face of what?"

Referring back to The Zen of Python by Tim Peters:

"In the face of ambiguity, refuse the temptation to guess."

The missing word is ambiguity.

Python

import codecs
import this

cipher = "va gur snpr bs jung?"
decoded = codecs.decode(cipher, "rot-13")
print("Decoded hint:", decoded)
# "in the face of what?"

# Notice this.d contains the rotation mapping dictionary:
print("".join(this.d.get(c, c) for c in cipher))

# Searching Zen of Python for the sentence:
zen = codecs.decode(this.s, "rot-13")
for line in zen.split("\n"):
    if "In the face of" in line:
        print("Found line:", line)
        # "In the face of ambiguity, refuse the temptation to guess."

Go

package main

import (
	"fmt"
	"strings"
)

func rot13(s string) string {
	return strings.Map(func(r rune) rune {
		switch {
		case r >= 'a' && r <= 'z':
			return 'a' + (r-'a'+13)%26
		case r >= 'A' && r <= 'Z':
			return 'A' + (r-'A'+13)%26
		default:
			return r
		}
	}, s)
}

func main() {
	cipher := "va gur snpr bs jung?"
	fmt.Printf("Decoded hint: %s\n", rot13(cipher))
	// "in the face of what?"
	// From Zen of Python: "In the face of ambiguity..."
	fmt.Println("Answer: ambiguity")
}

Rust

fn rot13(s: &str) -> String {
    s.chars()
        .map(|c| match c {
            'a'..='z' => ((c as u8 - b'a' + 13) % 26 + b'a') as char,
            'A'..='Z' => ((c as u8 - b'A' + 13) % 26 + b'A') as char,
            _ => c,
        })
        .collect()
}

fn main() {
    let cipher = "va gur snpr bs jung?";
    let decoded = rot13(cipher);
    println!("Decoded hint: {decoded}");
    // "in the face of what?"
    // Answer: ambiguity
    println!("Answer: ambiguity");
}

Language Comparison

Feature Python Go Rust
Built-in Easter Egg import this executes the easter egg directly in the runtime No language Easter eggs in runtime No Easter eggs in standard distribution
ROT-13 Codec Built into stdlib via codecs.decode(..., 'rot-13') strings.Map closure with modular arithmetic Iterator chars().map().collect()
Pattern Matching match statement (Python 3.10+) switch statement on runes Exhaustive match on char ranges ('a'..='z')

Key insight: Python's this module (PEP 20) is a famous easter egg written by Tim Peters, using a custom ROT-13 dictionary (this.d). In Go and Rust, modular arithmetic over ASCII character boundaries ('a'..='z') is both trivial and zero-dependency.

Next Level

Replace bonus with ambiguity:

http://www.pythonchallenge.com/pc/hex/ambiguity.html