How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Ingo U Your Own Question
Ingo U
Ingo U, Software Engineer
Category: Homework
Satisfied Customers: 755
Experience:  Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
Type Your Homework Question Here...
Ingo U is online now
A new question is answered every 9 seconds

Using two dimensional data. Write a python function called

This answer was rated:

Using two dimensional data.

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.


If the file input_puzzle.txt contains:


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:



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).

You need to spend $3 to view this post. Add Funds to your account and buy credits.
Ingo U and other Homework Specialists are ready to help you

Related Homework Questions