My for loop isn't being called in Jupyter Notebooks

I was trying to execute a for loop in Jupyter Notebooks as part of [This exercise].

The context is finding a line of regression by trial and error, but the problem is that the for loop itself seems to simply be ignored.

datapoints = [(1, 2), (2, 0), (3, 4), (4, 4), (5, 3)]
smallest_error= float('inf')

for m in list(possible_ms):
    print('The loop is being executed')
    for b in list(possible_bs):
        all_error=calculate_all_error(m, b, datapoints)
        if all_error < smallest_error:
            print('Found smaller error')
            smallest_error= all_error

print('Smallest error =', smallest_error)
print('m = ', best_m)
print('b = ', best_b)

This produces the following output:

Smallest error = inf
m =  0
b =  0

As you can see, everything inside the loop has simply done nothing. I have tried resetting the kernel and running all cells, but it didn’t help. There is no error message, so I have no idea what is wrong. Anyone know what the issue is? Thank you in advance.

Find out on the lines before exactly what is being fed into the iterable part of that for loop with print or something similar.

What is the type/length etc. of possible_ms? What about list(possible_ms)? If it’s not iterating at all, which seems likely given the lack of output (print should probably be called numerous times) then why not?

You could consider commenting out a few lines so you are checking the right section if there’s too much to take in at once. Multi-line comments can be achieved by creating a string literal with triple quotes without any assignment, e.g. the nonsense comment below

This is my
multi-line com

Thanks for responding, I realised I had accidentally defined the lists as tuppes, and it ran when I fixed it.