Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 5. Write a Python program that prompts the user to enter the size of an array. Generate a square matrix of size entered by

image text in transcribed
Problem 5. Write a Python program that prompts the user to enter the size of an array. Generate a square matrix of size entered by the user. Populate the matrix with random numbers between 1 and 50. Each time you run the program you supposed to get different numbers. Your program should modify the matrix in such a way that, diagonal element in each row should be the largest number Hint: use the following lines of code to generate a random number between 1 and 50 import random nt( random.rand int( 1 ,50)) Sample Output Enter the size of a matrix 5 Matrix generated: [[12. 47. 45. 13. 43.1 [11. 41. 37. 50. 21.1 Enter the size of a matrix3 [28. 19. 38. 5. 39.1 [1. 13. 37. 26. 33.11 Matrix generated: [18. 29. 32.1 Matrix modified: [47. 26. 37. [47. 12. 45. 13. 43.1 [11. 50. 37. 41. 21.1 [13. 1. 22. 11. 7.1 5. 19. 28. 39. 38. 10. 13. 33. 26. 37.11 [17. 8. 18.11 Matrix modified: [(32. 18. 29.1 (26. 47. 37. [17. 8. 18.11

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

What is Centrifugation?

Answered: 1 week ago

Question

To find integral of ?a 2 - x 2

Answered: 1 week ago

Question

To find integral of e 3x sin4x

Answered: 1 week ago

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago