Vectorized backpropagation exercise

I am doing exercise to ‘Replicate this vectorisation for the simple first network we saw earlier’, for vectorized backpropation. Has anyone done this exercise, as I am a bit confused on gradient calculation in grad function for simple feed forward network. Please share your work if possible. Thanks in advance.