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)
| 23 | |
| 24 | |
| 25 | def 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 | |
| 39 | data: str = Path(__file__).parent.joinpath("words.txt").read_text(encoding="utf-8") |