NumPy - Creating ArraysWhat does the function np.arange(5) do in NumPy?ACreates an array with values from 1 to 5BCreates an array with values from 0 to 4CCreates an array with values from 0 to 5DCreates an array with values from 1 to 4Check Answer
Step-by-Step SolutionSolution:Step 1: Understand np.arange with one argumentWhen np.arange is called with one argument n, it creates values starting from 0 up to but not including n.Step 2: Apply np.arange(5)So np.arange(5) creates an array with values 0, 1, 2, 3, 4.Final Answer:Creates an array with values from 0 to 4 -> Option BQuick Check:np.arange(5) = [0 1 2 3 4] [OK]Quick Trick: np.arange(n) starts at 0 and stops before n [OK]Common Mistakes:Assuming it starts at 1Including the stop valueConfusing with range() function
Master "Creating Arrays" in NumPy9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More NumPy Quizzes Aggregation Functions - np.sum() and axis parameter - Quiz 3easy Array Data Types - Type casting with astype() - Quiz 3easy Array Data Types - Why dtypes matter for performance - Quiz 10hard Array Data Types - Float types (float16, float32, float64) - Quiz 7medium Array Operations - Logical operations (and, or, not) - Quiz 9hard Array Operations - In-place operations for memory efficiency - Quiz 9hard Broadcasting - Broadcasting rules - Quiz 10hard Indexing and Slicing - Why indexing matters - Quiz 7medium Indexing and Slicing - Indexing returns views not copies - Quiz 3easy NumPy Fundamentals - What is NumPy - Quiz 11easy