You filed this under NLP Course 1, but this is DLS. I moved it for you by using the little “edit pencil” on the title.
That is not the code they gave you in the template. It is this:
for l in range(1, L):
Also remember how loops and indexing work in python: everything is “0 based”. Try running this code and watch what happens:
for ii in range(1,5):
print(f"ii = {ii}")
print(f"After loop ii = {ii}")
If you want to get a clean copy of the notebook to see that you must have changed the loop logic, there is a topic about that on the DLS FAQ Thread.