This commit is contained in:
Viacheslav Zhukov
2020-03-07 14:40:11 +03:00
parent a1cd0b0b78
commit c1ebd7f048

View File

@@ -423,17 +423,16 @@ np.negative(A,out=A)
np.multiply(A,B,out=A) np.multiply(A,B,out=A)
< q36 < q36
Extract the integer part of a random array using 5 different methods (★★☆) Extract the integer part of a random array of positive numbers using 4 different methods (★★☆)
< h36 < h36
hint: %, np.floor, np.ceil, astype, np.trunc hint: %, np.floor, astype, np.trunc
< a36 < a36
Z = np.random.uniform(0,10,10) Z = np.random.uniform(0,10,10)
print (Z - Z%1) print (Z - Z%1)
print (np.floor(Z)) print (np.floor(Z))
print (np.ceil(Z)-1)
print (Z.astype(int)) print (Z.astype(int))
print (np.trunc(Z)) print (np.trunc(Z))