The Joy of Computing using Python Week 7: Programming Assignment - Jan-Jul 2023

         NPTEL PROGRAMMING ASSIGNMENTS

The Joy of Computing Using Python

Weekk 7 Programming Assignment 1
Last Day of Submission: 16-Mar-2023

Given a sqaure matrix M, write a function DiagCalc that calculates the sum of left and right diagonals and prints it respectively.

Input Formate:
  Integer, List
Output Formate:
 Integer, Integer

Input:    
3
 1 2 3
4 5 6
 7 8 9

Output:
15
15


the joy of computing using python



 

  



Week 7 Programming Assignment 2
Last Day of Submission: 16-Mar-2022

Given a matrix M write a function Transpose which accepts a matrix M and return the transpose of M.


Input Formate:
  Integer, List(Matrix)
Output Formate:
 Transpose Matrix


Input
  2
  1   2
 3  4

Output
  1  3
  2 4


the joy of computing using python





 

  

   n = int(input())
   M = []
   for i in range(n):
         L = list(map(int, input().split()))
         M.append(L) 
   print(Transpose(M))




Week 7 Programming Assignment 3
Last Day of Submission: 16-Mar-2022

Given a matrix M write a function snake that accepts a matrix M and returns a list which contain elements in snake pattern of matrix M
.

Input Formate:
 Integer, List(Matrix)
Output Formate:
 Snake List

Input
 2
 1  2
3  4

Output
 [1,  2,  4,  3]


the joy of computing using python


 

  


n = int(input())
M = []
for i in range(n):
    L = list(map(int, input().split()))
    M.append(L)
print(snake(M))

Post a Comment (0)
Previous Post Next Post