Question: Write a function named create _ mat that creates a square matrix of an arbitrary size having the structure given in the example below. This

Write a function named create_mat that creates a square matrix of an arbitrary size having the structure given in the example below. This function should take the size of a square matrix as an integer (n) and outputs the special matrix (S) as shown in the example below. You MUST use numpy arrays to create this matrix.
The code has already been provided to define a function named create_mat that accepts the input variable n and returns the output variable S.
Examples:
Note that n is defined as input to the function. Do not overwrite values in this variable in your code. Be sure to assign a value to the function output variable (S).
HARDCODING IS NOT ALLOWED!!! IT MEANS, YOU CANNOT DIRECTLY PRINT THE RESULT WITHOUT PERFORMING ANY OPERATIONS. OTHERWISE, YOU CANNOT PASS THE HIDDEN TESTS!!!
DO NOT CHANGE ANYTHING IN THE TEMPLATE ASIDE FROM ADDING YOUR OWN CODE IN THE SPECIFIED AREA. OTHERWISE THE TESTS MIGHT NOT WORK AND YOU WILL NOT BE ABLE TO PASS THEM!!!!!
DO NOT USE ANY BUILT-IN FUNCTION (i.e., count(), index(), reverse(), sort(), sorted(), etc.) in PYTHON.
For example:
Test Result
print(np.asarray(create_mat(5),dtype=int))
[[11010]
[311303]
[5131950]
[71521257]
[917232729]]
print(np.asarray(create_mat(10),dtype=int))
[[1101010101]
[32130303030]
[523395050505]
[7254155707070]
[92743576990909]
[112945597181110110]
[1331476173839113013]
[1533496375859399150]
[1735516577879510110517]
[19375367798997103107109]]
Answer:(penalty regime: 0%)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!