In the function defined above the axis was kept = 1 which in case of two dimensional arrays is true for column wise addition of points but in case of three dimensional array or higher, the axis for column addition changes right , it will be =2 since in order the first is the dimension the second is the row and the third is the column.
So therefore incase of the for loop where sir used it to get the answer for the higher dimension, it should be changed to axis=2 for 3rd and higher dimensions.
As you can see from the above example from what i meant.