<filename>py/dcp/problems/math/freq_table.py<gh_stars>1-10
from collections import defaultdict

def get_freq_table(fn, iters : int):
    
    freq = defaultdict(int)

    for _ in range(int(iters)):
        freq[fn()] += 1

    for index in range(len(freq)):
        freq[index] /= iters

    return freq
<filename>py/dcp/problems/math/freq_table.py<gh_stars>1-10
from collections import defaultdict

def get_freq_table(fn, iters : int):
    
    freq = defaultdict(int)

    for _ in range(int(iters)):
        freq[fn()] += 1

    for index in range(len(freq)):
        freq[index] /= iters

    return freq