There are a lot of ways to write the for-loop ranges. These impact how you write the rest of the code, and any time you start manipulating vector indices individually, there’s a big chance for mistakes that are hard to debug.
The ranges that the assignment authors used seem to make the rest of the code simpler.
Tips:
At 1, use “num_rows”
At 2, use “i+1, num_rows”
With this, the only calculated index values you’ll need are:
- num_rows-1-i
- num_rows-1-j
Update for the new version of this notebook: You may need to substitute the variable “row” for either i or j.