Hi! I might be confused about how np.arange()
works, but it seems to me that there might be an error in the exercise for this page:
The questions is what happens to a here:
a = np.arange(5)
a + 20
I would’ve thought that now, a = [20, 21, 22, 23, 24]
, but the answer given is that a = [0, 1, 2, 3, 4]
. Is that right? If so, why?
Welcome there,
The question, I believe, was specifically made to require the reader to read carefully, and think about the topic of mutation:
If you are confused, often, the best thing to do is to just play with some code:
Pretty sure it’s explained in the video: both “what” is happening and “why”.
system
Closed
4
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.