Python Program to Calculate Diagonal, Upper Triangular, and Lower Triangular Sum of a Matrix