words=['one','two','one','three','one'] word_counts=dict() #after the loop the dictionary will have each word frequency for word in words: try: word_counts[word]+=1 except: word_counts[word]=1