Question: dictionary or list comprehensions, e . g . , [ * * 2 tor i in range ( 1 0 ) ] with open (
dictionary or list comprehensions, eg tor in range
with open explicitly open and close the file instead
the ternary operator use an if instead
recursion
exceptions tryjexcept
type annotations
importing libraries unless a library is explicitly mentioned in the specitication
Background
Word search is a word game that involves searching for words in a random grid of letters. This program simulates the game by searching for words in a grid. The program differs from the physical game in several ways:
The physical game is usually played with a grid. Your program will generalize this to any grid where N is determined by the size of the grid provided see next bullet point
The physical game uses a random gnd Your program wil read the grid of letters from a tile.
Definitions
Given a grid of letters and a list of words a word in is legal if it meets the following criteria:
it is at least three letters long;
It can be formed from letters in that are adjacent along a row two cases: going lefttoright or righttoleft a column two cases: going toptobottom or bottomtotop or a diagonal one case: going upperleft to lowerright; and
File Names
Your program should be in a file named wordsearch. pyNOTE: use an underscore, not a dash.
Expected Behavior
Write a program, in a flie named wordsearch. py to do the tollowing:
Read the wordlist file into a list and the gridofletters file into a square grid. You may assume that these files are organized as follows:
the wordlist file contains one word per line;
Search this grid for legal words. Matches of words found in the grid letters separated by whitespace. Note: The file may be empty.
Collect the legal words found into a list and then print them out as indicated under Output format below.
Examples
The following is an example of the grid of letters file:
tabley
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
