alt solution to exercise 4

Uses nbytes instead of itemsize * size
This commit is contained in:
Giacomo Petrillo 2025-08-25 17:53:21 +02:00
parent 9be9c8cd23
commit ee15dec2c7

View File

@ -37,6 +37,9 @@ hint: size, itemsize
Z = np.zeros((10,10))
print("%d bytes" % (Z.size * Z.itemsize))
# Simpler alternative
print("%d bytes" % Z.nbytes)
< q5
How to get the documentation of the numpy add function from the command line? (★☆☆)