NumPy - FundamentalsWhich of the following is the correct syntax to create a NumPy array from a Python list named data?Aarray(data)Bnp.array(data)Cnp.array[data]Dnumpy.array[data]Check Answer
Step-by-Step SolutionSolution:Step 1: Recall correct NumPy array creation syntaxThe correct syntax uses parentheses with np.array and the list inside.Step 2: Identify incorrect syntaxSquare brackets are invalid for function calls; 'numpy' must be imported as 'np' to use np.array.Final Answer:np.array(data) -> Option BQuick Check:Array creation syntax = np.array(data) [OK]Quick Trick: Use parentheses, not square brackets, to create arrays [OK]Common Mistakes:Using square brackets instead of parenthesesUsing 'numpy' without import aliasMixing syntax styles
Master "Fundamentals" in NumPy9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More NumPy Quizzes Aggregation Functions - np.argmin() and np.argmax() - Quiz 4medium Aggregation Functions - Aggregation along specific axes - Quiz 2easy Array Data Types - Why dtypes matter for performance - Quiz 11easy Array Manipulation - np.concatenate() for joining arrays - Quiz 12easy Array Operations - Logical operations (and, or, not) - Quiz 14medium Broadcasting - Scalar and array broadcasting - Quiz 3easy Creating Arrays - np.linspace() for evenly spaced arrays - Quiz 4medium Creating Arrays - np.linspace() for evenly spaced arrays - Quiz 10hard Creating Arrays - np.full() for custom-filled arrays - Quiz 11easy Indexing and Slicing - Fancy indexing with integer arrays - Quiz 12easy