Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON 3 Write a function, dotProduct(), that takes in two matrices (as 2D array of integers), and returns a third matrix that is the Dot

PYTHON 3

Write a function, dotProduct(), that takes in two matrices (as 2D array of integers), and returns a third matrix that is the Dot Product of the two. If you never studied the Dot Product, read here for an explanation and how to compute it: https://www.mathsisfun.com/algebra/matrix-multiplying.html If the two matrices do not have the right dimensions to compute the Dot Product, your function should return None. Remember, if the number of columns of the 1st matrix is not equal to the number of rows of the 2nd matrix, the Dot Product cannot be computed. You can safely assume that the two 2D arrays have inner arrays of equal length (i.e. not a jagged array). Examples # from the article above matrix1 = [[3, 4, 2]] matrix2 = [ [13, 9, 7, 15], [8, 7, 4, 6], [6, 4, 0, 3], ] dotProduct(matrix1, matrix2) returns [[83, 63, 37, 75]]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started