Answered step by step
Verified Expert Solution
Link Copied!

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,

  1. print the first 10 numbers, the last 10 numbers and the variance.
  2. 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.
  3. calculate the sum of the difference array. Can you get this result without calculation?
  4. sort the original array.
  5. 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

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

Step: 3

blur-text-image

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

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

Explain the causes of indiscipline.

Answered: 1 week ago

Question

4. Help trainees set challenging mastery or learning goals.

Answered: 1 week ago

Question

2. Enrolling employees in courses and programs.

Answered: 1 week ago