Question
(10 marks) A-5. A-5: Create a random integer numpy two-dimensional array of size 5x9, where the integer values range from 1 to 100 (100 inclusive).
(10 marks) A-5.
A-5: Create a random integer numpy two-dimensional array of size 5x9, where the integer values range from 1 to 100 (100 inclusive). Set the random generator seed to be 26. Call the array as S. Print the dimensions, shape, and size of S. (4 marks)
A-6. Print alternate columns starting from column indexed 3 and all the rows of S. (3 marks)
A-7. Create a new numpy array M1 that contains third-row elements of S in order of column 8, then 5, then 3, then 1. Similarly, create a new array M2 that contains fourth-row elements in order of column 9, then column 7, then column 2, then 8. (4 marks)
A-8. Create a new one-dimensional array by joining M1 and M2. Create another new two-dimensional array by vertically joining M2 below M1. (4 marks)
A-9. Create a copy of S, say P. Sort the elements in the even columns of P (that is, in each even column, the smallest element is in the first row, and the largest in the last row). Print both S and P. (4 marks)
A-10. Add the following array [1,2,3,4,5,6,7,8,9] to all the rows of P. Print all the elements of updated P that are strictly between 20 and 60.
use python please, and I need answers as text not photos so I can copy the code
A-5. A-5: Create a random integer numpy two-dimensional array of size 59, where the integer values range from 1 to 100 (100 inclusive). Set the random generator seed to be 26 . Call the array as S. Print the dimensions, shape, and size of S. (4 marks) A-6. Print alternate columns starting from column indexed 3 and all the rows of S. (3 marks) A-7. Create a new numpy array M1 that contains third-row elements of S in order of column 8, then 5, then 3, then 1. Similarly, create a new array M2 that contains fourth-row elements in order of column 9 , then column 7 , then column 2 , then 8. (4 marks) A-8. Create a new one-dimensional array by joining M1 and M2. Create another new two-dimensional array by vertically joining M2 below M1. (4 marks) A-9. Create a copy of S, say P. Sort the elements in the even columns of P (that is, in each even column, the smallest element is in the first row, and the largest in the last row). Print both S and P. (4 marks) A-10. Add the following array [1,2,3,4,5,6,7,8,9] to all the rows of P. Print all the elements of updated P that are strictly between 20 and 60
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started