Checkpoint

Checkpoint: The Lost Dispatch

A guild messenger dropped a dispatch in the harbor. The ink still reads Wpw mvbuk aol thw pu aol vsk spnoaovbzl. but the key was lost at sea.

Build a code-cracker that tries every key, scores each try, and reports the best one. That's the whole chapter in one program.

Assignment

shift_text(text, shift) is ready for you.

  1. score(text, words) returns how many words of text are in words (lowercase, punctuation .,!? stripped, repeats count).
  2. crack(secret, words) tries every key from 0 to 25. Key k decodes with shift_text(secret, -k). Return a tuple (key, message) for the highest score. On a tie, keep the smallest key.
  3. Print the result as Key 7: ... (the key, a colon, then the message).