Answer the question
In order to leave comments, you need to log in
How to split the interval [0; 1] into half-intervals?
import collections
co = collections.Counter()
file_txt = open("test.txt","r", encoding='utf-8')
for line in file_txt:
co.update(line.lower())
d = dict(co)
count = sum(d.values())
low = 0.0
high = 1.0
for key, value in d.items():
print( low ,': ', key,':', value*1/count)
0.0 : ш : 0.2727272727272727
0.0 : у : 0.2727272727272727
0.0 : р : 0.09090909090909091
0.0 : : 0.09090909090909091
0.0 : м : 0.18181818181818182
0.0 : о : 0.09090909090909091
0 Ш 0,272727273
0,272727273 У 0,545454545
0,545454545 М 0,727272727
0,727272727 Р 0,818181818
0,818181818 _ 0,909090909
0,909090909 О 1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question