Remix Library / Techy

Secret Codes

Encrypt messages with a Caesar cipher, then crack codes without the key, like a real codebreaker.

Beginner Python
No account needed: you’ll start as a guest.
read-only · remix to edit
Output

What you'll learn

  • Strings & characters
  • The % (modulo) operator
  • Functions
  • Brute-force search
  • Scoring with sets

Challenges

Remix it, then try these. Each one is a bit harder than the last.

  1. Encrypt a message for a friend and see if they can crack it.
  2. Add ROT13, which is just a Caesar shift of 13.
  3. Make the cipher work on numbers too.
  4. Build a Vigenère cipher, where the shift changes with each letter of a keyword.
  5. Improve the cracker by scoring letter frequencies (E is the most common letter in English).