I have a 2D list (matrix) in which I want apply a function to all elements after a certain position, or perform some search.
Example: Starting from the point (1,2)
in the list
[
[1,2,3,4]
[5,6,7,8]
[9,10,11,12]
]
means that we want to start iterating from the number 7
and skip the first row and the first two elements from the second row.
I can just start from the beginning and check when I am ahead of the element at point (x,y) and just do nothing before, but basically the idea is to save some iterating cycles if the 2D list (matrix) is bigger.
I've tried changing the iterating variables for the first iteration (like I would in C++ for example), but that failed:
flag = True
for i in range(height):
for j in range(width):
if flag:
i = x
j = y
flag = False
...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…