Answer the question
In order to leave comments, you need to log in
What should be done here?
There is a task from stepik's course:
Write a program that takes as input a rectangular matrix as a sequence of lines ending with a line containing only the string "end" (without quotes)
The program must output a matrix of the same size, with each element in position i, j is equal to the sum of the elements of the first matrix at positions (i-1, j), (i+1, j), (i, j-1), (i, j+1). For extreme characters, the neighboring element is on the opposite side of the matrix.
In the case of a single row/column, the element is itself a neighbor in the corresponding direction.
Found the answer on github: https://github.com/Testudinate/Python/blob/master/...
Who can tell what to do and what the task and code are about?
I want to understand and write myself, but I just don’t understand what to do, please explain to me stupid ...
Answer the question
In order to leave comments, you need to log in
Did you listen to Stepik's course? Or at least some book on Python opened? It's just not clear where such a problem could arise if there is no understanding of how to solve it? There is another example in front of my eyes. It is not clear what to explain - the condition is formulated extremely clearly and clearly: we enter the matrix, recalculate its elements according to the described rule, and display the result. What is unclear? For each step?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question