Question: 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

 Problem 5. Write a Python program that prompts the user to

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!