Merge pull request #25 from joeyfreund/patch-1
Add alternative solution using matrix multiplication operator
This commit is contained in:
commit
44b5e1e940
@ -477,7 +477,10 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"Z = np.dot(np.ones((5,3)), np.ones((3,2)))\n",
|
||||
"print(Z)"
|
||||
"print(Z)",
|
||||
"\n\n",
|
||||
"# Alternative solution, in Python 3.5 and above\n",
|
||||
"Z = np.ones((5,3)) @ np.ones((3,2))"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -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. (★☆☆)
|
||||
|
Loading…
Reference in New Issue
Block a user