Correcting solution to the 'round away from 0' exercise

This commit is contained in:
ibah
2016-08-23 13:09:56 +02:00
parent 429db566ac
commit 9e6559e6eb
2 changed files with 2 additions and 2 deletions

View File

@@ -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))"
] ]
}, },
{ {

View File

@@ -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? (★☆☆)