Q.13 What will be output for the following code?import numpy as npa = np.array([1,2,3])print a
Question
Q.13 What will be output for the following code?import numpy as npa = np.array([1,2,3])print a
Solution
The code you provided is written in Python, but it contains a syntax error. The print statement should be written as print(a) instead of print a.
Here is the corrected code:
import numpy as np
a = np.array([1,2,3])
print(a)
When you run this code, it will output:
[1 2 3]
This is because you are creating a numpy array with the elements 1, 2, and 3, and then printing that array.
Similar Questions
What is the output of the following code ? import numpy as np a = np.array([[1,2,3]]) print(a.shape)(2,3)None of the above(3,1)(1,3)
30. What does the following Python code output? import numpy as np a = np.array([[1, 2], [3, 4], [5, 6]]) print(a[:, 1]) [1, 3, 5][1, 4, 5][2, 3, 6][2, 4, 6]
Output of the below snippet: import numpy as np a=np.array([100,2,300,]) print(a[0],a[2])
NumPy array Example_A contains the following values:What result will you get from running the code Example_A[1,2]?
what is the result of the following lines of code:a=np.array([0,1])b=np.array([1,0])print( a @b )
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.