Hello I need to Write a word search program twice: Once in Dr Racket and once in
ID: 3667461 • Letter: H
Question
Hello I need to Write a word search program twice: Once in Dr Racket and once in Python. You may use Python 2 or Python 3. In Dr. Racket, set the language to #lang racket, and implement the following function: ; CONTRACT: find-words : width length letters -> List ; PURPOSE: Returns a list of dictionary words 4 letters or longer ; that can be found in a matrix of letters that has dimensions width ; by length. Widths and length are natural numbers. ; CODE: (define (find-words width length letters) '() ; Put your implementation here instead of returning an empty list ) letters will be a list of width many literal strings of characters. Each literal string of characters has length length. e.g. The following is a possible definition of letters with width 4 and length 7.
'("abcdefg"
"abdefg"
"abcdefg"
"abcdefg")
I am having much trouble with this I need to use s file called linuxwords or a dictionary of sord to find the words below is the code I have so far need to search all directions havnt even been able to start the python yet. below is in racket / scheme
#lang racket
(require 2htdp/batch-io)
;; Define all-words to be a list of words read one per line from a file named linuxwords
(define all-words (map string-downcase (read-lines "C:\Users\patriceclark\Desktop\Comp Lang\Walker Small Project 1\listOfWords.txt")))
;; Define all-long-words to be a list of words in all-words that are longer than 3 letters
(define all-long-words (filter (lambda (str)
(
< 3 (string-length str)
))
all-words)
)
;; Return a matrix which is a list of lists of characters from a list of strings
(define (make-matrix list-of-strings)
(map string->list list-of-strings)
)
;; Return the character at position x,y in a matrix
(define (char-at x y matrix)
(list-ref (list-ref matrix y) x)
)
;; Define some test input
(define test-input '(
"catss"
"dogst"
"flogo"
"zlzpp"
"fling"
)
)
Explanation / Answer
Word Search in Python:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.