Skip to content

Instantly share code, notes, and snippets.

@theavey
Created July 14, 2022 18:24
Show Gist options
  • Save theavey/9e898e250700056d4f60717784a411d1 to your computer and use it in GitHub Desktop.
Save theavey/9e898e250700056d4f60717784a411d1 to your computer and use it in GitHub Desktop.
some simple code to narrow down remaining wordle solutions
import pandas as pd
words = pd.read_table(
"https://static.nytimes.com/newsgraphics/2022/01/25/wordle-solver/assets/solutions.txt",
header=None,
)[0]
letters = "[qwtyuiopdfghjkzxvbnm]"
words[
words.str.match(
f"{letters.replace('t', '')}"
f"{letters.replace('o', '')}"
f"{letters.replace('i', '')}"
f"{letters.replace('n', '')}"
f"{letters}"
)
& words.str.contains("o")
& words.str.contains("i")
& words.str.contains("t")
& words.str.contains("n")
].str.split(
"", expand=True
) # .drop(columns=[0, 6]).sort_values([1, 2, 3, 4, 5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment