Skip to content

Instantly share code, notes, and snippets.



Last active Jan 13, 2021
What would you like to do?
Solve the NYT spelling bee. Mind you this isn't perfect.
#!/usr/bin/env python3
import sys
# called via ` ktocail`
# last letter in the word is required
def get_words(letters):
# prevent dupes
seen = set()
check = set(list(letters))
required = letters[-1]
with open('/usr/share/dict/american-english') as f:
for line in f:
# strip out words with apostrophes
word = line.strip().lower().split("'")[0]
if len(word) >= 4 and word not in seen:
if required in word and set(word).issubset(check):
if check == set(word):
print('PANAGRAM ', end='')
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment