NPTEL PROGRAMMING ASSIGNMENTS
The Joy of Computing Using Python
Week 7 Programming Assignment 1
Last Day of Submission: 15-Sep-2022
Given a sqaure matrix M, write a function DiagCalc which calculate the sum of left and right diagonals and print it respectively.
Input Formate:
Square Matrix
Output Formate:
Two Number(sum of both diagonals)
Input:
[[1, 2],[3, 4]]
[[1, 2],[3, 4]]
Output:
5
Week 7 Programming Assignment 2
Last Day of Submission: 15-Sep-2022
Given a matrix M of MxN write a function Transpose which accepts a matrix M and return the transpose of M.
Input Formate:
Matrix
Output Formate:
Transposed Matrix
Input
[[1, 2][3, 4]]
Output
Input
[[1, 2][3, 4]]
Output
[[1, 3][2, 4]]
Week 7 Programming Assignment 3
Last Day of Submission: 15-Sep-2022
Given a matrix M of MxN write a function snake that accepts a matrix M and returns a list which contain elements in snake pattern of matrix M.
Input Formate:
Matrix
Output Formate:
List
Input
Input
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Output
[[1, 2, 3], [6, 5, 4], [7, 8, 9]]
[[1, 2, 3], [6, 5, 4], [7, 8, 9]]