alt solution to exercise 4

Uses nbytes instead of itemsize * size
This commit is contained in:
Giacomo Petrillo committed 2025-08-25 17:53:21 +02:00
1 parent 9be9c8cd23
commit ee15dec2c7
1 file changed
+3
+3
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? (★☆☆)