Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For Python 3 Write code to do the following tasks. Your code MUST be able to pro

ID: 3866301 • Letter: F

Question

For Python 3

Write code to do the following tasks. Your code MUST be able to produce custom exceptions messages if the input data has had dimensions. Look up the raise function and create an ArithmeticError message that would pop up in that case. Submit your commented functions as a single module named linalg.py as well as a document containing your answers to the following questions. Calculate the transpose of the following matricies: (a) A_1 = [1] (b) A_2 = [1 6 5 3] (c) A_3 = [8 6 6 3 10 2] (d) A_4 = [1 6 5 1] (e) A_4 = [3 3.1 3.14 3.141 pi]

Explanation / Answer

#include <stdio.h>

int main()

{

int arr[10][10],transpose[10][10],r,c,i,j;

printf("Enter rows and columns of matrix: ");

scanf("%d %d", &r, &c);

printf(" Enter elements of matrix: ");

for(i=0; i<r; ++i)

for(j=0; j<c; ++j)

{

printf("Enter element a%d%d: ",i+1, j+1);

scanf("%d", &arr[i][j]);

}

printf(" Entered Matrix: ");

for(i=0; i<r; ++i)

for(j=0; j<c; ++j)

{

printf("%d ", arr[i][j]);

if (j == c-1)

printf(" ");

}

for(i=0; i<r; ++i)

for(j=0; j<c; ++j)

{

transpose[j][i] = arr[i][j];

}

printf(" Transpose of Matrix: ");

for(i=0; i<c; ++i)

for(j=0; j<r; ++j)

{

printf("%d ",transpose[i][j]);

if(j==r-1)

printf(" ");

}

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote