Skip to content

letters / alphabet [terminology]

Terminology

Usage

  • Use alphabet for the complete character set from which substitutions are generated.
  • Use letters for a relevant collection of letters that may not be a complete alphabet.
  • Avoid generic chars when completeness or domain matters.
alphabet = "abcdefghijklmnopqrstuvwxyz"
while front:
    # ...
    for word in front:
        for i, ch in enumerate(word):
            for letter in alphabet:
                if letter == ch:
                    continue
                cand = word[:i] + letter + word[i + 1:]
                # ...

See 127. Word Ladder.