Thanks for this exercise. Iād say this is both more interesting and exciting than the assignment 2. Moreover, Iām sure I can learn a lot from this. Even better, I hope I can look up for more creative answers here.

Letās put it this way: thereās a big bag of balls, say 336 (678) balls. Thereāre 6 cartons, which can hold 7 boxes each, and each of these boxes, thereāre 8 partitions in it to store these balls. Number these balls from 0 to 335, and store them into paritions in ascending order. Now, you need to find where the Ball 99 (this is the 100th ball) is stored.

We know 1 box carries 8 balls, and 1 carton carries 7 boxes. In math, we know 1 carton carries 7*8 balls. So, we basically know the Ball 99 is in Carton 1 (the first Carton is Carton 0). From here, I bet you have an idea how to look for Ball 99 with the help of // and %.

Is there any resource online where I can find the explanations to these exercises?

Googling these problems returns plenty of solutions for the questions, but not explanations. For problems after the first 20 or so, Iām unable to find explanations (specially ones where the code is already given).

Iād post the problems here but they may end up being too many eventually.

x[1::2,::2] means row1 to last row with step 2, col0 to last col with step 2
x[::2,1::2] means row0 to last row with step 2, col1 to last col with step 2

On Question number
35. How to compute ((A+B)*(-A/2)) in place (without copy)? (ā ā ā)
I tried dividing A = np.array([1,2,3,4]) on numpy 1.19.1

np.divide(A,4,out=A)

TypeError Traceback (most recent call last)
in
----> 1 np.divide(A,4,out=A)
TypeError: No loop matching the specified signature and casting was found for ufunc true_divide

Then doing google it was said to use np.true_divide(A,4,out=A) but in my case using that gave same error. But doing simple A=A/4 is giving answer. Please help