words.py 490 Bytes
Newer Older
Adam Blank's avatar
Adam Blank committed
1
2
3
4
5
6
from io import TextIOWrapper


def get_words() -> list[str]:
    words: list[str] = []
    f: TextIOWrapper = open('06/dictionary.txt')
Adam Blank's avatar
Adam Blank committed
7
8
9
    for line in f.readlines():
        line = line.strip()
        words.append(line)
Adam Blank's avatar
Adam Blank committed
10
11
12
13
14
    f.close()
    return words


def get_wordle_words() -> list[str]:
Adam Blank's avatar
Adam Blank committed
15
16
17
18
19
    wordle_words: list[str] = []
    for word in get_words():
        if len(word) == 5:
            wordle_words.append(word)
    return wordle_words
Adam Blank's avatar
Adam Blank committed
20
21
22


WORDLE_WORDS: list[str] = get_wordle_words()