Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Python 3+, randomly generate a numpy array with 1000 numbers in the shape of (10000,). The numbers should be in the range of 1
In Python 3+, randomly generate a numpy array with 1000 numbers in the shape of (10000,). The numbers should be in the range of 1 and 50 inclusive. Please include screenshots. Then,
- print the first 10 numbers, the last 10 numbers and the variance.
- calculate the difference of every two adjacent numbers in the array. For example, if the original array is [2,4,-1], then the array of difference should be [2, -5] because 4-2=2 and -1-4=-5. You should NOT use a for/while loop.
- calculate the sum of the difference array. Can you get this result without calculation?
- sort the original array.
- print the first 10 numbers, the last 10 numbers and the variance of the sorted array. Is the variance changed?
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