Lower Triangle Total
m is a square 2-D array. Return the sum of the cells that are on the main diagonal or below it (the cells where the row number is at least the column number), as an int. Hint: np.tril.
Example 1
m [[1,2],[3,4]]
returns 8
1 + 3 + 4 = 8, leaving out the 2 above the diagonal.
Constraints
1 <= len(m) <= 8
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Median ScoreBeginner
- Multiples Up ToBeginner
- Overlap CountBeginner
- Pass or FailBeginner
- Percent of TotalBeginner
- Pick ItemsBeginner
- Price With TaxBeginner
- Range of ReadingsBeginner