219k views
2 votes
Which Numpy function do you use to create an array? (Points : 1) np

np.array
np.numpy
numpy

User Galactica
by
5.2k points

1 Answer

1 vote

Answer:

The correct option is np.array

Step-by-step explanation:

Numpy is a library to perform numerical calculation in python. It allows us to create and modify vectors, and make operations on them easily. Numpy arrays are an excellent alternative to python lists. Some of the key advantages of numpy arrays are that they are fast, easy to work with, and offer users the opportunity to perform calculations through full arrays.

To start using numpy, the library must be imported:

import numpy as np

The most common way to create a vector or matrix already initialized is with the np.array function, which takes a list (or list of lists) as a parameter and returns a numpy matrix. The numpy arrays are static and homogeneous typing. They are more efficient in the use of memory.

Example:

list = [25,12,15,66,12.5]

v = np.array (list)

print (v)

User Ozh
by
5.2k points