# W2_Quiz_Wrong Answer Key in Number 8?

Hi, I tried rechecking my answer and i tried running the code and i think it’s correct but the answer on the quiz says otherwise. is there something that i missed that made me choose the wrong answer or is there really an error in the answer key? thanks

Hi @jgcanete ,

I would start by mentally following the nested for-loop. How is the inner loop traversing a? horizontally, right? And how does b look like? like a vertical vector, right?

So what shape should b have to do an element-wise multiplication that resembles the nested for-loop?

Try these hints and let me know if you need some more help.

Thanks,

Juan

1 Like

In addition to Juan’s great analysis, think about the dimensions of the output if you use your selected solution. If you dot a 3 x 4 matrix with a 4 x 1 vector, the result will have dimension 3 x 1. You demonstrated that with your example code. But the output of those for loops will be 3 x 4.

Oh, sorry, they also actually told you that in their error response. I just didn’t read that part carefully enough the first time through.

1 Like

thanks for this the key is to determine the element wise multiplication which i failed to realize. by that, I should have thought of transposing b. i guess i failed to really understand what the for loop meant to do which is element wise multiplication. below is what I thought the for loop was for which is wrong. Again, thank you for the clarification

Excellent @jgcanete !!! Lets now keep moving forward into this great adventure!

Juan

1 Like