Vectorize A Computation With NumPy (Fixed Seed)

#2 · 2 of 20Free sample
Question

Vectorize A Computation With NumPy (Fixed Seed)

Use np.random.seed(0), create an array of 10 random floats. Multiply by 2 in a vectorized manner. Print 'VECTOR_SUM:' plus the sum of the result for a consistent check.
solution.py
Loading editor…
Sign up to unlock

The reference answer is one click away.

Free account unlocks the reference answer, the explanation, and the GPT tutor on every exercise in the library.

  • Reference answer + explanation revealed after each attempt
  • GPT tutor for every problem
  • Progress saved on the platform
  • 1,598 graded exercises
  • Free forever — no credit card
Sign up to unlock

The reference answer is one click away.

Free account unlocks the reference answer, the explanation, and the GPT tutor on every exercise in the library.

  • Reference answer + explanation revealed after each attempt
  • GPT tutor for every problem
  • Progress saved on the platform
  • 1,598 graded exercises
  • Free forever — no credit card
All exercises in Python: Writing Efficient Code (Time Complexity, Vectorization)