Skip to content

Instantly share code, notes, and snippets.

Last active January 20, 2022 00:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
# Wordle -
# This little program looks up a suitable word given
# state of the puzzle (from 2022-Jan-19)
# -----
# rems_known = "nip"
def eliminated_letter_in_word(w: str) -> bool:
eliminated_letters = "raseblmchksweufy"
for i in eliminated_letters:
if i in w:
return True
return False
count = 0
with open('/usr/share/dict/american-english') as f:
for w in f:
if len(w) == 6:
# NOTE: We look for 6 because w will have newline
# (Pdb) print(w.split('.'))
# ['Abby\n']
w = w.rstrip()
count += 1
if not eliminated_letter_in_word(w):
if w[2] == 'i':
if 'n' in w and 'p' in w:
# The word has 'i' in the middle, and contains
# the letters 'n' and 'p'
print(f"{count} 5-letter words searched")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment