Complete the code to create a NumPy array from a Python list.
import numpy as np my_list = [1, 2, 3] arr = np.[1](my_list) print(arr)
The np.array() function converts a Python list into a NumPy array.
Complete the code to create a 2D NumPy array from a list of lists.
import numpy as np my_list = [[1, 2], [3, 4]] arr = np.[1](my_list) print(arr.shape)
Using np.array() on a list of lists creates a 2D NumPy array. The shape shows its dimensions.
Fix the error in the code to convert a list to a NumPy array.
import numpy as np my_list = [5, 6, 7] arr = np.[1](my_list) print(arr)
The correct function is np.array() with a lowercase 'a'. Python is case-sensitive.
Fill both blanks to create a NumPy array and check its data type.
import numpy as np my_list = [1, 2, 3] arr = np.[1](my_list) print(arr.[2])
np.array() creates the array, and arr.dtype shows the data type of elements.
Fill all three blanks to create a 2D array, get its shape, and convert it back to a list.
import numpy as np my_list = [[1, 2], [3, 4]] arr = np.[1](my_list) print(arr.[2]) print(arr.[3]())
np.array() creates the array, arr.shape shows its dimensions, and arr.tolist() converts it back to a Python list.