
sys imported and unused. os only used to create cwd which is implied with open try/except block that doesn't handle anything json loaded to create a more expensive defaultdict dict created just for membership testing instead of set membership test performed by fetching key value instead of using in
12 lines
255 B
Python
12 lines
255 B
Python
def load_words():
|
|
with open('words_alpha.txt') as word_file:
|
|
valid_words = set(word_file.read().split())
|
|
|
|
return valid_words
|
|
|
|
|
|
if __name__ == '__main__':
|
|
english_words = load_words()
|
|
# demo print
|
|
print('fate' in english_words)
|