Home »
Python »
Python NumPy MCQs
Observe the following code and identify what will be the outcome (1)?
6. Observe the following code and identify what will be the outcome?
import numpy as np
a=np.array([1,2,3,4,5,6])
print(a)
- [1 2 3 4 5]
- [1 2 3 4 5 6]
- [0 1 2 3 4 5 6]
- None of the mentioned above
Answer: B) [1 2 3 4 5 6]
Explanation:
In the above code, an array of six elements declared and assign it to the variable a. In the next line of code, a is printing. So, all the elements which are in array a will be print on screen.