Im trying to calculate a cumulative distribution into a dictionary. The distribution should take letters from a given text and find the probability over the times they appear in the text, and from this it should calculate the cumulative distribution. I don't know if I'm doing it the right way, but here's my code:
with open('text') as infile:
text = infile.read()
letters = list(text)
letter_freqs = Counter(letters(text))
letter_sum = len(letters)
letter_proba = [letter_freqs[letter]/letter_sum for letter in letters(text)]
And now I wan't to calculate a cumulative distribution, and plot it like a histogram, can someone help me?