
![def secondary trace (matrix) : 1 Return sum of values on secondary diagonal. >>mO[, 0], [0, 111 > ml[, 1, 1], [2, 2, 21,[3, 3, 311 >>> m2 [[3, 4],[6, 911 >>> secondary trace (m0) >>> secondary trace (ml) >>> secondary trace (m2) 10 Tr TT 11 for i in range (len (matrix)): for j in range (1en (matrix)): if ilen (matrix) - -1: sum += matrix [i] [j] return sum](http://img.homeworklib.com/questions/6db40780-ba1c-11ea-adb2-a32472778f87.png?x-oss-process=image/resize,w_560)
![def seconday trace single loop (matrix): IT TT 11 Return sum of values on secondary diagonal >>> mo = [[1, 0], [0, 1]] >>> m2 = [[3, 4], [6, 911 >>> seconday trace single loop (mO) >>>seconday trace single loop (mi) >>> seconday trace single loop (m2) 10 1 YI # YOUR CODE IS HERE](http://img.homeworklib.com/questions/6e4e1710-ba1c-11ea-95f5-dbf9f04f5844.png?x-oss-process=image/resize,w_560)
def secondary_trace_single_loop(matrix):
diag_sum=0
size = len(matrix[0])#find the lenth of the column
for i in range(size):#loop untill the column ends
diag_sum += matrix[i][size-i-1]#sum the secong diagonal
elemnt
return diag_sum#return the sum of diagonal
m0=[[1,0],[0,1]]
m1=[[1,1,1],[2,2,2],[3,3,3]]
m2=[[3,4],[6,9]]
print(secondary_trace_single_loop(m0))#call the function with
matrix and print the results
print(secondary_trace_single_loop(m1))
print(secondary_trace_single_loop(m2))
output and code sneps
If you have any query
regarding the code please ask me in the comment i am here for help
you. Please do not direct thumbs down just ask if you have any
query. And if you like my work then please appreciates with up
vote. Thank You.
use python and one loop to solve this problem Q6: Secondary Trace You are given a...
Q2 15 Points Let A € Mnxn(R). Define trace(A) = {1-1 Qiji (i. e. the sum of the diagonal entries) and tr : Mnxn(R) +R, A H trace(A). Q2.1 2 Points Show that U = {A € Mnxn(R): trace(A) = 0} is a subspace of Mnxn (R). Please select file(s) Select file(s) Q2.2 4 Points Compute dim(im(tr)) Enter your answer here and dim(ker(tt) Enter your answer here each (1pt) Justify your answer. (2pt) Enter your answer here Q2.3 5 Points...
PLEASE USE WHILE LOOP (NOT FOR LOOPS). Python programming. In this problem, you should write one function named multiply. This function should accept one parameter, which you can assume will be a list with one or more integers in it. (If you don’t know what I mean when I say “list of integers”, go do the reading!) The function should loop through all of the numbers in the list, and multiply all of the numbers together. It should return the...
In C++ Do not use a compiler like CodeBlocks or online. Trace the code by hand. Do not write "#include" and do not write whole "main()" function. Write only the minimal necessary code to accomplish the required task. Save your answer file with the name: "FinalA.txt" 1) (2 pts) Given this loop int cnt = 1; do { cnt += 3; } while (cnt < 25); cout << cnt; It runs ________ times ...