Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python Given the following integer array from a range between 100 to 200 that the difference between each element is 10. Reshape to the

Using Python Given the following integer array from a range between 100 to 200 that the difference between each element is 10. Reshape to the following 5X2 dimention array. [[100 110] [120 130] [140 150] [160 170] [180 190]] Complete the codes as indicated, to print numpy array attributes (use function and dynamic coding. Hard coded answer will not receive credit) Length of each element of array in bytes is: 4 Array Shape is: (5, 2) Array dimensions are: 2 The datatype of the array is: int32 or int64 (32 or 64 dpending on the operating system) hint: consider using arange (code already provided) together with reshape function. arange can be used to create 10X1 array then use reshape to conver to 5X2 array. Use print function to print the above message.

print("Creating 5X2 array using numpy.arange")

sampleArray = np.arange(100, 200, 10) sampleArray = sampleArray.reshape(5,2)

print("Printing Array") print(sampleArray) print("Printing numpy array Attributes") print("1. Length of each element of array in bytes is: ", sampleArray.itemsize) # answer already provided, as example of dynamic coding

# provide your answer as indicated below print("2. Array Shape is: ", #provide answer here print("3. Array dimensions are: ", #provide answer here print("4. The datatype of the array is: ", #provide answer here

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

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions