An anagram is a word formed by rearranging the letters of another word. For example, Elvis yields the eerie trio evils, lives, and veils. Does this mean Elvis still lives but veils his evil existence? In the book Harry Potter and the Chamber of Secrets, “I am Lord Voldemort” is an anagram of the evil wizard’s real name, Tom Marvolo Riddle. “Lord Earldom Vomit” is also an anagram of Tom Marvolo Riddle, but author J.K. Rowling had the good sense to pass on that one.

In this chapter, first you’ll find all the anagrams for a given word or name. Then, you’ll write a program that lets a user interactively build an anagram phrase from ...

Get Impractical Python Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.