def sort(word): return "".join(sorted(list(word))) def anagram(word1, word2): return sort(word1) == sort(word2) print anagram("teal", "late") print anagram("teal", "latte") # Alternate: Print the word counts. # for (word, count) in count_of.items(): # print word, ' = ', count