I wish to write a for loop such that the stopping criterion is that which satisfies a difference between two consecutive elements in a list. The list is appended from the for loop as shown in the code below:
m, n = 100, 4
counter1 = []
tol = 1e-8
x_not = np.zeros(n)
for iterate in range(100):
    for rows in range(m):
        y = My_func(x_not, rows)
        x_not = y
        counter1.append(norm(x_not))
        if counter1[i-1] - counter1[i] < tol:
            break
I wish the for loop to stop whenever any two consecutive elements is less than tol. I need someone to help implement this code in Python. My_func is a predefined function.
 
    