(Nov-04-2019, 02:55 PM)arshad Wrote: Why j in range(0) is not excuted because it value present in array A. i.e A[1][0]. why the code doesnot pick this value?
range(0) returns a 0. That means that it will NOT iterate (or it will iterate 0 amount of times) and it goes directly to the next iteration on the upper loop where i=2.
This check outputs what you were asking for:
for i in range(n): if i <= 1: value=1 else: value=i-1 for j in range(value): B[i] += sum + A[i][j]
Output:[0. 1. 2. 5. 9.]