At Notion, you are asked to organize a list of words into groups where each group contains words that are anagrams of one another. Write code that is modular, readable, and easy to test.
Implement a function that takes a list of lowercase strings and returns a list of groups, where each group contains all words that are anagrams. Two words are anagrams if they contain the same characters with the same frequencies.
words, a list of stringsExample 1
words = ["eat", "tea", "tan", "ate", "nat", "bat"][["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]Example 2
words = [""][[""]]1 <= len(words) <= 10^40 <= len(words[i]) <= 100words[i] contains only lowercase English letters