Computer Science, asked by minahil9007, 11 months ago

What is the correct way of creating an array? Select one: a. a = array( 1, 2, 3, 4 ) b. a = array([ 1, 2, 3, 4 ]) c. a = array[ 1, 2, 3, 4 ] d. a = array[( 1, 2, 3, 4)]

Answers

Answered by EshanVasaikar
0

Answer:

c.

Explanation:

a = array[1,2,3,4]

It is syntax correct.

Array is created by writing array and square brackets.

Answered by BrainlyYoda
1

a = array([ 1, 2, 3, 4 ]) is the correct way of creating an array

b. a = array([ 1, 2, 3, 4 ])

Extra Information

array function is a part of the NumPy library and NumPy library is a part of Python programming language.

Format of array function

array(data type, value list)

Códe to import NumPy Library and to use array function

import numpy as np

a = np.array([2, 3, 4])

print(a)

Output of the Códe

[2  3  4]

Array

An array is a type of data structure that stores a collection of elements in which each element has an array index. It stores elements of the same data type.

Python is created by Guido van Rossum and came into existence in 1991. It is a high-level and general programming language. It is a very lucid programming language as it has a good language construct and object-oriented approach. It is dynamically typed and garbage-collected.

Similar questions