Computer Science, asked by venkataramanablr2020, 1 month ago

Create a numpy array "array1" of 10 numerical values array1= np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) python program​

Answers

Answered by Equestriadash
76

\tt import\ numpy\ as\ np\\array1\ =\ np.array([1,\ 2,\ 3,\ 4,\ 5,\ 6,\ 7,\ 8,\ 9,\ 10])

Before creating arrays, the \tt numpy module, which is used for the same, must be imported first.

An array can be created using the \tt array() function. Printing array1, the output would look like this:

>>>\ \tt print(array1)\\\\\sf [1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10]

An array is a set of elements enclosed in square brackets, separated by a space. They're similar to lists, but have differences. Elements cannot further be added to arrays and they're usually faster in giving outputs when certain commands are passed.

Similar questions