It seems you have a problem later in the code ... (e.g. when collecting statistics). Check out this little snippet:
import random, collections
data = collections.defaultdict(int)
for x in range(1000000):
data[round(random.random(),1)] += 1
print(data)
, 0 1, , , .
, :
defaultdict(<class 'int'>,
{0.4: 100083,
0.9: 99857,
0.3: 99892,
0.8: 99586,
0.5: 100108,
1.0: 49874,
0.7: 100236,
0.2: 99847,
0.1: 100251,
0.6: 100058,
0.0: 50208})