Open abbyt99 opened 6 years ago
I'm not sure if this is the easiest way to do it, but here is a relatively simple method for counting the frequency of a key in a dictionary:
def wordListToFreqDict(wordlist): wordfreq = [wordlist.count(p) for p in wordlist] return dict(zip(wordlist,wordfreq))
I was wondering what the easiest way to count the frequency of a key in a dictionary is.