Question: Could someone please explain what this code exactly means:

```
for i,j in [(i,j) for i in range(len(rows)-2,-1,-1) for (j) in range(i+1)]:

```

When there is an array called rows. what would is assign to i and j?

I believe i would be the n-1th index for the array, but I'm not sure about j. Would it just be i+1?

Answer: 
```
[(i,j) for i in range(len(rows)-2,-1,-1) for (j) in range(i+1)]

```

Is the same as:

```
result = []
# from len(rows)-2 to 0, decrementing by one each time
for i in range(len(rows)-2,-1,-1):
       # from 0 to i        
    for j in range(i+1):
       result.append((i, j))

```
It works as product of sequences:

```
>>> [(i, j) for i in [1, 2] for j in ['a', 'b']]
[(1, 'a'), (1, 'b'), (2, 'a'), (2, 'b')]

```

This is similar to:

```
from itertools import product
print [(i, j) for i, j in product(list1, list2)]

```