a = [0.999, 0.121, 0.230, 0.001]
for i in range(0, 4):
a.insert(i, round(a[i] - (a[i] * 100 % 10) / 100, 1))
a.pop(i + 1)
import numpy as np
def trunc(values, decs=0):
stepper = 10.0 ** decs
return np.trunc(values * stepper) / stepper
a = np.random.sample((10, 5))
print(a)
a = trunc(a, 2)
print(a)
[[0.80774294 0.49759797 0.12831778 0.0507127 0.93884821]
[0.40449397 0.66256411 0.68941394 0.9249191 0.24395077]
[0.04315995 0.18290855 0.5908672 0.2102119 0.81539927]
[0.35844866 0.5186572 0.29508712 0.57636076 0.64102832]
[0.94639274 0.09793527 0.73766807 0.80979653 0.84808608]
[0.46454466 0.58734548 0.63087822 0.10865253 0.82981857]
[0.8473419 0.23920123 0.3373125 0.4772781 0.35829208]
[0.03148842 0.70653864 0.85633527 0.72635685 0.47321859]
[0.76828975 0.08494009 0.45071368 0.79358861 0.6005338 ]
[0.3820037 0.02684243 0.1404288 0.04466791 0.32699522]]
[[0.8 0.49 0.12 0.05 0.93]
[0.4 0.66 0.68 0.92 0.24]
[0.04 0.18 0.59 0.21 0.81]
[0.35 0.51 0.29 0.57 0.64]
[0.94 0.09 0.73 0.8 0.84]
[0.46 0.58 0.63 0.1 0.82]
[0.84 0.23 0.33 0.47 0.35]
[0.03 0.7 0.85 0.72 0.47]
[0.76 0.08 0.45 0.79 0.6 ]
[0.38 0.02 0.14 0.04 0.32]]