Skip to content

Conversation

@gideonjeffrey
Copy link

Wonderful tutorials but I've noticed this problem. When prompted:

###Create a numpy array, filled with 3 random integer values between 1 and 10.

The listed solution is

np.random.randint(10, size=3)

But this code will produce a numpy array of size 3 with integer values between 0 and 10, not 1 and 10.

The returned array differs each time, of course, but the first time running the solution code in my notebook returned array([0, 4, 0]).

Instead, the solution code should be

np.random.randint(1, 10, size=3)

to specify 1 as the low value (inclusive) and 10 as the high value (exclusive). I'm ignoring the ambiguity of "between" in the prompt here, but perhaps clarifying inclusive/exclusive would be helpful too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant