-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspellBee.py
More file actions
30 lines (21 loc) · 739 Bytes
/
Copy pathspellBee.py
File metadata and controls
30 lines (21 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# let's cheat at Spelling Bee
def word_reader(filename):
# returns an iterator
return (word.strip() for word in open(filename))
if __name__ == "__main__":
import sys
if len(sys.argv) == 2:
rack = sys.argv[1].strip()
if len(rack) != 7:
print( "7 letters required, ",len(rack), "entered - <enter required letter + six more>")
exit()
else:
print("Usage: python cheat_at_Spelling Bee.py <enter required letter + six more>")
exit()
reqLet = rack[0] # required letter is first
words = word_reader('wordList.txt')
for word in words:
if set(word.lower()).issubset(set(rack)):
if (reqLet in word.lower()) and len(word) > 3:
print(word)
print("---------Done------------")