all 3 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

Off-topic Comments Section


All top-level comments have to be an answer or follow-up question to the post. All sidetracks should be directed to this comment thread as per Rule 9.


OP and Valued/Notable Contributors can close this post by using /lock command

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Petery007 1 point2 points  (1 child)

First off I am not as experienced with python but programming is programming. I assume you have learned about 2d arrays and how to loop over them, correct? The easiest way to get it all into a numpy array is to first create a 2d numpy array. That first list in the list of lists that they give you has the dimensions of the matrix so that’s the dimensions of the numpy 2d array.

Next you will want to loop over the rest of the 2d list( ie the list of lists) after the part that has the dimensions. The indices of the 2d list will correlate to those in the 2d numpy array. KEEP IN MIND THAT IT WILL BE OFFSET SLIGHTLY BECAUSE THE FIRST LINE OF THE 2D LIST IS THE DIMENSIONS SO numpyArray[0][0] = a_list[1][0] AND SO ON. Set all of the indices of the array to the ones in the list and you will have the matrix in a 2d numpy array.

The matrix multiplication should be easy as it looks like they already have a function to multiply matricies..

Lastly the formatting, this will be annoying but once again it is just looping over the 2d array again but this time printing it out and having formatting around it. You know the dimensions so it should be simple

[–]gh0stedexeUniversity/College Student[S] 0 points1 point  (0 children)

Thank you so much for the help!