I have hidden five 8-letter words in the grid below. You can find them by selecting one letter from each column, progressing from left to right. Each letter is used exactly once. Can you find the 5 words?
A W I A I A D E
T A C N L I N K
S T R A N I R G
S O R D N A S R
V E R E V N E T
Credit for this problem goes to Cliff Pickover
AARDVARK
SERENADE
STRAINER
TWINNING
VOCALIST
The program also found a 6th word, VOCALISE.
(The word list I used had about 83K words)
rawgrid = 'AWIAIADETACNLINKSTRANIRGSORDNASRVEREVNET'
grid = [[rawgrid[8*i+j] for j in range(8)] for i in range(5)]
verts = []
for j in range(8):
a = ''
for i in range(5):
a = a + grid[i][j]
verts.append(a)
words = open("words.txt", "r")
data = words.read()
word_list = data.split("\n")
for i,w in enumerate(word_list[:]):
word_list[i] = w.upper()
for c in w:
if c not in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
print(w)
word8s = [w for w in word_list if len(w) == 8 ]
filtered = word8s[:]
for i in range(8):
for w in word8s:
if w[i] not in verts[i]:
if w in filtered:
filtered.remove(w)
words.close()
print(filtered)
|
Posted by Larry
on 2022-05-03 17:29:28 |