abhayacc201 / Python-Coding-Questions

0 stars 3 forks source link
hacktoberfest hacktoberfest-accepted hacktoberfest-starter hacktoberfest2023

Hacktoberfest

This Branch is OPEN for Open Source Contribution in Hacktobesfest Program You can submit your pull request here.

Create a pull request

Create a pull request to ask collaborators for feedback on your changes. Pull request review is so valuable that some repositories require an approving review before pull requests can be merged. If you want early feedback or advice before you complete your changes, you can mark your pull request as a draft. For more information, see "Creating a pull request." Address review comments Reviewers should leave questions, comments, and suggestions. Reviewers can comment on the whole pull request or add comments to specific lines. You and reviewers can insert images or code suggestions to clarify comments. For more information, see "Reviewing changes in pull requests."

You can continue to commit and push changes in response to the reviews. Your pull request will update automatically. Delete your branch After you merge your pull request, delete your branch. This indicates that the work on the branch is complete and prevents you or others from accidentally using old branches. For more information, see "Deleting and restoring branches in a pull request."

Don't worry about losing information. Your pull request and commit history will not be deleted. You can always restore your deleted branch or revert your pull request if needed.

Program to multiply two matrices using nested loops

3x3 matrix

X = [[12,7,3], [4 ,5,6], [7 ,8,9]]

3x4 matrix

Y = [[5,8,1,2], [6,7,3,0], [4,5,9,1]]

result is 3x4

result = [[0,0,0,0], [0,0,0,0], [0,0,0,0]]

iterate through rows of X

for i in range(len(X)):

iterate through columns of Y

for j in range(len(Y[0])):

iterate through rows of Y

   for k in range(len(Y)):
       result[i][j] += X[i][k] * Y[k][j]

for r in result: print(r)