Premium problem38. Build Array from Generator

Easy Locked

Using a generator that yields the integers 0 to n-1, build and return the corresponding 1-D float array, consuming the generator lazily rather than first materializing a list.

Input

10

Output

[0. 1. 2. 3. 4. 5. 6. 7. 8. 9.]

Only the returned value is graded, so a different approach will still pass. The constraint is the point of the exercise, not a rule the grader enforces.

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)