Question: Problem 3 - Word Search Create a program in a file called word_search.py where we input a string and then a word to search for.

 Problem 3 - Word Search Create a program in a file
called word_search.py where we input a string and then a "word" to

Problem 3 - Word Search Create a program in a file called word_search.py where we input a string and then a "word" to search for. We'll allow the word to be "hidden" in the following ways: 1. We can hide the word by using a gap, meaning that the word can be hidden with a gap of letters in between. a. We have hidden the word hello in hxexlxlxo with x's in between but they can be anything. b. The "word" abcd is hidden twice in aabbccdd. 2. The word can be hidden with an offset, meaning it can start in the middle of the string, a. The word abcd is "hidden" in xyzabcdxyz. 3. We can combine gaps and offsets: a. Gap is hidden in abcdgrasp NOTE: The gap has to be the same size between each letter in the word! So your task is to find out and display all of the different offsets and gaps with which the original word is hidden in the string. linux1[150] % python3 word_search.py Enter the block of characters to search: abcdgrasp What word are we looking for? gap Found with offset = 4, gap = 2 linux1[151] % python3 word_search.py Enter the block of characters to search: aaabbbcccddd What word are we looking for? abcd Found with offset 0, gap = 3 Found with offset = 1, gap = 3 Found with offset 2, gap = 3 linux1[152] % python3 word_search.py Enter the block of characters to search: jklsdfljkasdfljkfasdkljfasdkl What word are we looking for? xyz [no output) linux1[153] % python3 word_search.py Enter the block of characters to search: hellohellohello What word are we looking for? hello Found with offset = o, gap = 1 Found with offset 5, gap = 1 Found with offset = 10, gap = 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!