MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / anagram

Function anagram

strings/anagrams.py:25–36  ·  view source on GitHub ↗

Return every anagram of the given word from the dictionary. >>> anagram('test') ['sett', 'stet', 'test'] >>> anagram('this is a test') [] >>> anagram('final') ['final']

(my_word: str)

Source from the content-addressed store, hash-verified

23
24
25def anagram(my_word: str) -> list[str]:
26 """
27 Return every anagram of the given word from the dictionary.
28
29 >>> anagram('test')
30 ['sett', 'stet', 'test']
31 >>> anagram('this is a test')
32 []
33 >>> anagram('final')
34 ['final']
35 """
36 return word_by_signature[signature(my_word)]
37
38
39data: str = Path(__file__).parent.joinpath("words.txt").read_text(encoding="utf-8")

Callers 1

anagrams.pyFile · 0.85

Calls 1

signatureFunction · 0.85

Tested by

no test coverage detected