Week 2 - last mini batch calc Ex. 2

hello all,

I am having trouble contextualizing the last mini-batch for some reason. I’ve created the following table for my logic:

Column 1 Column 2 Column 3 Column 4
Batch 1 Batch 2 Batch 3
start 0 64 128
end 64 128 20 remaining

According to my logic, the last mini batch should have a start:end of 128:20, but when I enter it, i receive the following error:

Can someone please advise? I do believe I am constructing batches 1 and 2 correctly…

Somehow the indexing must be wrong in your code for the last minibatch. Notice that your code produces 0 columns for that batch. So how could that happen? Either the start index is wrong or the end index is wrong or both. :nerd_face: Try printing the index values you are using (start, end). Might as well do it for all batches, so you can see how things play out.

Debugging is part of the job, right? No non-trivial code you ever write is going to be completely correct the first time. And I say this as a programmer with more than 50 years experience at this point. :scream_cat:

Oh, sorry, I didn’t read your post carefully enough the first time. What is the length you get if the start index is 128 and the end index is 20? The point is it’s not [start:length], it’s [start:end], right?

Hello Paul,

Thank you for the insight. I was able to complete the assignment with this tidbit!

Greatly appreciated!