Question

Find the sum of two equal-number integer matrices. Example: 2 2 + 5 8 = 7 10 5 4 4 10 9 14 First it asks the user for the numpython help please and thank you

0 0
Add a comment Improve this question Transcribed image text
Answer #1

n=int(input("Enter number of rows of two matrices"))#read number of rows
m1=[]
m2=[]
print("Enter matrix 1")
for i in range(n):
print("Enter row ",(i+1))
m1.append(list(map(int,input().split(" "))))#read matrix 1 each row at a time
  
print("Enter matrix 2")
for i in range(n):
print("Enter row ",(i+1))
m2.append(list(map(int,input().split(" "))))#read matrix 2 each row at a time
print("Result is:")
for i in range(n):
for j in range(len(m1[0])):
print(m1[i][j]+m2[i][j],end=" ")#add and print the Result
print()

Screenshots:

The screenshots are attached below for reference,

Please follow them for proper indentation and output.

Please upvote my answer .

Thank you.

1 n=int(input(Enter number of rows of two matrices)) 2 m1=[] 3 m2=[] 4 print(Enter matrix 1) 5- for i in range(n): 6 prin

Enter number of rows of two matrices2 Enter matrix 1 1 Enter row 2 2 Enter row 2 5 4 Enter matrix 2 1 2 Enter row 58 Enter ro

Add a comment
Know the answer?
Add Answer to:
python help please and thank you Find the sum of two equal-number integer matrices. Example: 2...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • phyton help please!!!!! Find the sum of two equal-number matrices. Example: First ask the user for...

    phyton help please!!!!! Find the sum of two equal-number matrices. Example: First ask the user for the number of rows of the two matrices. 2 2 + 5 8 = 7 10 54 4 10 9 14 Then ask the value of each of the rows of the two matrices, where each column of the row must be separated by a space (use the split function to convert the captured text to a list)

  • Please use Python 3, thank you~ Write a program that: Defines a function called find_item_in_grid, as...

    Please use Python 3, thank you~ Write a program that: Defines a function called find_item_in_grid, as described below. Calls the function find_item_in_grid and prints the result. The find_item_in_grid function should have one parameter, which it should assume is a list of lists (a 2D list). The function should ask the user for a row number and a column number. It should return (not print) the item in the 2D list at the row and column specified by the user. The...

  • How to write this code in python? please don't print the space for each row last number.

    how to write this code in python? please don't print the space for each row last number. Pascal's Triangle Pascal's Triangle is a number pattern with many interesting and useful properties. For example: Each number in the triangle is the sum of the two numbers above it. The number at row n and column k is equal to the binomial coefficient () "n choose k." 1 21 133 1 1 4 6 4 1 Write a program that prints Pascal's...

  • Please help me write a Pseudocode (please do NOT answer in JAVA or Python - I...

    Please help me write a Pseudocode (please do NOT answer in JAVA or Python - I will not be able to use those). Please ALSO create a flowchart using Flowgarithm program. Thank you so much, if answer is provided in Pseudocode and Flowchart, I will provide good feedback and thumbs up to the resonder. Thank you! Tic-Tac-Toe Game Write a program that allows two players to play a game of tic-tac-toe. Use a two- dimensional char array with three rows...

  • Write a MIPS program to that will take two 4x4 matrices, and calculate their sum and...

    Write a MIPS program to that will take two 4x4 matrices, and calculate their sum and product, using row major, and column major math (so this is actually 4 problems, but obviously they’re all pretty related). I generated two sample arrays to test 2   1       9       2 7   9       10      10 3   4       4       4 2   5       4       4 8 7 1 2 2 7 8 6 7 5 6 8 9 4 8 9 The output of your program...

  • Please help me in thsi question i have only 30 minutes this is python Question Two....

    Please help me in thsi question i have only 30 minutes this is python Question Two. 25 points. Write the missing function such that when the following code executes: import numpy as np # Assume the user enters a valid integer #Assume the user enters o valid integer rows - intinput("Enter number of rows (1-10 ")) inti nputl Enter number of columns 1-10 : columns matrix np.random.randint(1, 11, rows columns).reshapelrows, columns) print"Matrix Shape:" matrix.shape, "MatrixIn". matrix) result sum _border(matrix) print/"The...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a Python...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a Python statement that creates a two-dimensional list named values with 3 rows and 2 columns. Then write nested loops that get an integer value from the user for each element in the list. Then display the content of the list. Please see the outcome below: Outcome run: Enter the 1 element in the 1 row :1 Enter the 2 element in the 1 row :2...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a Python...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. Write a Python statement that creates a two-dimensional list named values with 3 rows and 2 columns. Then write nested loops that get an integer value from the user for each element in the list. Then display the content of the list. Please see the outcome below: Outcome run: Enter the 1 element in the 1 row :1 Enter the 2 element in the 1 row :2...

  • please solve using python thank you! Write a program which prompts the user to enter a...

    please solve using python thank you! Write a program which prompts the user to enter a number of rows, and prints a hollow square star pattern with 2 diagonals. Note: you can assume that the integer will always be > 1 and will be an odd number. For example: Input Result 5 Enter number of rows: 5 ***** ** ** * * * ** ** ***** 9 Enter number of rows: 9 ** ** ** * * * * *...

  • I'm a little crunched for time and need some help with these first two questions. Thank...

    I'm a little crunched for time and need some help with these first two questions. Thank you! Question 1.) Write a Java program that reads in sequence of integers from the user until user enters a negative number and stores them in an Integer ArrayList. Once read, display a bar chart based on the values stored in the ArrayList. For example, if the user inputs 2, 5, 3, 8, 4, and -1, then your program should display the bar chart...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT