Find_words | Computer Science homework help

Write a python function called find_words that finds and prints the list of valid words in a two-dimensional word puzzle.

 

The input arguments for this function are:

 

input_puzzle # XXXXX string of characters with NxN characters

 

valid_words_list: # XXXXX list of valid words separated by white spaces.

 

The function, find_words, should print the formatted original puzzle, the list of the valid words, and the formatted solved two-dimensional puzzle in capital letters (by removing all the unused characters). You should also write a main program that reads two files: input_puzzle.txt # XXXXX file contains the input puzzle as a string of characters.

 

valid_words.txt # XXXXX file contains a string of valid words (separated by spaces) See example below.

 

Example:

 

If the file input_puzzle.txt contains:

 

chzratytt

 

and the file valid_words.txt contains:

 

dog cat bird hello rat

 

then your main program should read the two input files and call the function find_words .

 

 

 

The function should then print the following formatted output:

 

Original puzzle:

 

| c | h | z |

 

| r | a | t |

 

| y | t | t |

 

Valid words in the puzzle are:

 

cat

 

rat

 

Solved puzzle:

 

| C |    |    |

 

| R | A | T |

 

|     |    | T |

 

 

 

Notes: The original puzzle should be printed as a properly formatted N rows by N columns table and it should be printed in lower case. There should be one space before and after each character.

 

The input_puzzle.txt file will contain N times N lower case characters. For example if the input_puzzle.txt file contains 49 characters then the puzzle will have 7 rows and 7 columns.

 

Only those words that exist in the valid_words.txt file are considered valid. For example the word “hat” exist in the original puzzle but since “hat” is not in the list of valid words then it is not included in the solution.

 

Valid words may be listed horizontally (only left to right), vertically (only top to bottom), diagonally (left to right/top to bottom ; or left to right/bottom to top) in the original puzzle.

 

The two-dimensional puzzle solution should be printed with all capital letters and all the unused letters should be removed (as shown above).

 

 

 

It must be Python 2.7. 

 

It would be great if this can be done before 12pm Central time.

 

–Thank you







Calculate Your Essay Price
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more