From 5bd4dca9e2bb55360bdc279dabe3a1c8f637caf6 Mon Sep 17 00:00:00 2001 From: Joey Freund Date: Fri, 30 Sep 2016 17:25:54 -0400 Subject: [PATCH] add solution with matrix-mult operator This solution work for Python 3.5 and above. --- 100 Numpy exercises.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/100 Numpy exercises.md b/100 Numpy exercises.md index 2a1e55b..7177eae 100644 --- a/100 Numpy exercises.md +++ b/100 Numpy exercises.md @@ -208,6 +208,10 @@ color = np.dtype([("r", np.ubyte, 1), ```python Z = np.dot(np.ones((5,3)), np.ones((3,2))) print(Z) + +# Alternative solution, in Python 3.5 and above +Z = np.ones((5,3)) @ np.ones((3,2)) +print(Z) ``` #### 25. Given a 1D array, negate all elements which are between 3 and 8, in place. (★☆☆)