Help with an assignment? Finding words in a grid.
I'm very very new to python, just a heads-up. I need help with an assignment where I'm supposed to find selected words from a grid of random letters. I have no idea where to start. I don't know how to approach this. Uni doesn't help much, just lets us wander in the dark alone, without guidance. So I have to resort to internet for some kind of pointers. This is the full description: Write code to prompt the user for a filename, and attempt to open the file whose name is supplied. If the file cannot be opened the user should be asked to supply another filename; this should continue until a file has been successfully opened. The file will contain on each line a row from the grid. For example: xmmycxvtljlqbbybkoumjqwbtbufve buubmekxbeydqmcnzyjpvdackomdmi Write code to read, in turn, each line of the file, remove the newline character and append the resulting string to a list of strings. After the input is complete the strings in the list should be displayed on the screen, one per line. Note that grids used for testing the submitted programs may have different widths and heights from the sample one that will be provided. Grids will contain only lower-case letters. 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 right-to-left) or vertical (downwards or upwards) occurrence of the word. If a word occurs more than once the function is required to find only one occurrence so you should stop searching once the word has been found. My attempts so far: https://code.sololearn.com/c9o7lbD8xSaK/#py Further on I don't know how to actually search within the list. Any pointers on how to do that? Do I have to create while loops? How do I do that in this particular case? I'm not sure how I'm supposed to structure it. I barely know the basics of python and have to handle this assignment. So any advice and explanation would be greatly appreciated.