A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Create a 4X2 integer array and Prints its attributes using python programming
Q:

Create a 4X2 integer array and Prints its attributes using python programming

0

Create a 4X2 integer array and Prints its attributes

Note: The element must be a type of unsigned int16. And print the following Attributes: –

  • The shape of an array.
  • Array dimensions.
  • The Length of each element of the array in bytes.

Expected Output:

Printing Array

[[64392 31655]
 [32579     0]
 [49248   462]
 [    0     0]]

Printing NumPy array Attributes

Array Shape is:  (4, 2)
Array dimensions are  2
Length of each element of array in bytes is  2

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

import numpy

firstArray = numpy.empty([4,2], dtype = numpy.uint16) 
print("Printing Array")
print(firstArray)

print("Printing numpy array Attributes")
print("1> Array Shape is: ", firstArray.shape)
print("2>. Array dimensions are ", firstArray.ndim)
print("3>. Length of each element of array in bytes is ", firstArray.itemsize)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now