Convolution_model_Step_by_Step_v1 range confusion

I did not get why we are using range(n_H) and range(n_W) instead of range(n_H_prev-f +1) and range(n_W_prev -f +1) in the assignment.

This is the 1st programming assignment in Week 1 of this course.

The point is that indexing in python is 0-based, either for arrays or “for” loops. Try running the following loop and watch what happens:

for ii in range(5):
    print(f"ii = {ii}")

But the larger point is that the loops here are over the output space, not the input space, right? You need to touch each point in the output space and the stride happens in the input space. That’s where you may skip positions, depending on the stride value.