Bird
0
0

What does np.array() do when given a Python list?

easy📝 Conceptual Q11 of 15
NumPy - Creating Arrays
What does np.array() do when given a Python list?
AIt converts the list into a numpy array for easier math operations.
BIt changes the list into a Python dictionary.
CIt sorts the list in ascending order.
DIt removes duplicates from the list.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of np.array()

    np.array() is designed to convert Python lists into numpy arrays.
  2. Step 2: Recognize the benefit of numpy arrays

    Numpy arrays allow fast, element-wise math operations that lists do not support.
  3. Final Answer:

    It converts the list into a numpy array for easier math operations. -> Option A
  4. Quick Check:

    np.array() converts lists to arrays [OK]
Quick Trick: np.array() turns lists into arrays for math [OK]
Common Mistakes:
  • Thinking np.array() sorts the list
  • Confusing arrays with dictionaries
  • Assuming it removes duplicates

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NumPy Quizzes