Preview:
def anagramGrouping(words):
    groups_list = []
    sets_list = {}
    
    for word in words:
        new = frozenset(word)
        if (new in sets_list.keys()):
            sets_list[new].append(word)
        else:
            sets_list[new] = [word]
    
    for key in sets_list:
        groups_list.append(sets_list[key])
    
    return(groups_list)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter