Correcting solution to the 'round away from 0' exercise
This commit is contained in:
@@ -585,7 +585,7 @@
|
|||||||
"# Author: Charles R Harris\n",
|
"# Author: Charles R Harris\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Z = np.random.uniform(-10,+10,10)\n",
|
"Z = np.random.uniform(-10,+10,10)\n",
|
||||||
"print (np.trunc(Z + np.copysign(0.5, Z)))"
|
"print (np.copysign(np.ceil(np.abs(Z)), Z))"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ print(np.array([np.nan]).astype(int).astype(float))
|
|||||||
# Author: Charles R Harris
|
# Author: Charles R Harris
|
||||||
|
|
||||||
Z = np.random.uniform(-10,+10,10)
|
Z = np.random.uniform(-10,+10,10)
|
||||||
print (np.trunc(Z + np.copysign(0.5, Z)))
|
print (np.copysign(np.ceil(np.abs(Z)), Z))
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 30. How to find common values between two arrays? (★☆☆)
|
#### 30. How to find common values between two arrays? (★☆☆)
|
||||||
|
|||||||
Reference in New Issue
Block a user