954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

The Word-Search Function python

Hello,

can anyone help me on the fellowing...

Write a function that will take two arguments: a word to be searched for and a list of strings containing the grid.
The function should search for a horizontal left-to-right or vertical downwards occurrence of the word (e.g. activex and capslock in the sample grid).

bhysen
Newbie Poster
2 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

I dont know, maybe you should ask Mike.

lollercop
Newbie Poster
1 post since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

i will ask Mike but seems later. tomorrow defo will ask him lol

bhysen
Newbie Poster
2 posts since Dec 2010
Reputation Points: 10
Solved Threads: 0
 

Easiest way to look in columns is to do transposing of the grid and search second time in rows. You can transpose list by doing

trasposed = list(zip(*grid))


You can keep count in the for loop by using enumerate on lines/colums.

pyTony
pyMod
Moderator
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
 

And where is his code?

no hands?????
;)

richieking
Master Poster
764 posts since Jun 2009
Reputation Points: 61
Solved Threads: 152
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: