import numpy as np

arr = np.arange(18).reshape(6, 3)

print(arr)

print('sum of all elements:', arr.sum())
print('sum of rows        :', arr.sum(axis=1))
print('sum of columns     :', arr.sum(axis=0))
    

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: