NPTEL PROGRAMMING ASSIGNMENTS
The Joy of Computing using Python
Week 7: Programming Assignment 1 - Binary Matrix
Due on 2021-09-16, 23:59 ISTGiven a matrix with M rows and N columns, you are required to check if the matrix is a Zero-One Matrix. A Zero-One or a Binary matrix is a matrix in which all the elements are either 0 or 1.
Input format for the code
The first line of the input contains two space separated integers M a000nd N which represents the number of rows and the number of columns respectively.
Next M lines represent the elements in M rows with each line containing N space separated integers.
Output format for the code
Print Yes if matrix is binary otherwise No
Given a matrix with M rows and N columns, you are required to check if the matrix is a Zero-One Matrix. A Zero-One or a Binary matrix is a matrix in which all the elements are either 0 or 1.
Input format for the code
The first line of the input contains two space separated integers M a000nd N which represents the number of rows and the number of columns respectively.
Next M lines represent the elements in M rows with each line containing N space separated integers.
Output format for the code
Print Yes if matrix is binary otherwise No
Week 7: Programming Assignment 2 - Number Triangle II
Due on 2021-09-16, 23:59 ISTGiven an integer input 'n', print a palindromic triangle of n lines as shown in the example.
Input Format must be like
The input contains a number n (n < 10).
Output Format must be like
Print n lines corresponding to the number triangle.
Example if
Input is
5
the Output must be
1
121
12321
1234321
123454321
Given an integer input 'n', print a palindromic triangle of n lines as shown in the example.
Input Format must be like
The input contains a number n (n < 10).
Output Format must be like
Print n lines corresponding to the number triangle.
Example if
Input is
5
the Output must be
1
121
12321
1234321
123454321
Week7: Programming Assignment 3 - Lower Triangular Matrix
Due on 2021-09-16, 23:59 ISTGiven a N X N square matrix, transform the Matrix into a Lower Triangular Matrix by setting all the elements except the lower triangle as zero.
A Lower triangular matrix is a square matrix (where the number of rows and columns are equal) where all the elements above the diagonal are zero.
Input Format must be like
The first line of the input contains an integer N which represents the number of rows and the number of columns.
Next N lines represent the elements of the matrix.
Output Format must be like
Print the Lower Triangular form of the Matrix
Example if
Input is
3
1 -2 3
-2 3 1
3 1 2
the Output must be
1 0 0
-2 3 0
3 1 2
Given a N X N square matrix, transform the Matrix into a Lower Triangular Matrix by setting all the elements except the lower triangle as zero.
A Lower triangular matrix is a square matrix (where the number of rows and columns are equal) where all the elements above the diagonal are zero.
Input Format must be like
The first line of the input contains an integer N which represents the number of rows and the number of columns.
Next N lines represent the elements of the matrix.
Output Format must be like
Print the Lower Triangular form of the Matrix
Example if
Input is
3
1 -2 3
-2 3 1
3 1 2
the Output must be
1 0 0
-2 3 0
3 1 2