From 0c5f1c01302c8208251f61730ba74e078bfd0ac8 Mon Sep 17 00:00:00 2001 From: ok-open-sc <114725648+ok-open-sc@users.noreply.github.com> Date: Sun, 30 Oct 2022 03:11:17 -0400 Subject: [PATCH] Increased Readability Of Variables (#6400) * Increased Readability Of Variables * Update anagrams.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update anagrams.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: Christian Clauss Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- strings/anagrams.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/strings/anagrams.py b/strings/anagrams.py index b671d3f3d..fb9ac0bd1 100644 --- a/strings/anagrams.py +++ b/strings/anagrams.py @@ -26,15 +26,15 @@ def anagram(my_word: str) -> list[str]: >>> anagram('final') ['final'] """ - return word_bysig[signature(my_word)] + return word_by_signature[signature(my_word)] data: str = Path(__file__).parent.joinpath("words.txt").read_text(encoding="utf-8") word_list = sorted({word.strip().lower() for word in data.splitlines()}) -word_bysig = collections.defaultdict(list) +word_by_signature = collections.defaultdict(list) for word in word_list: - word_bysig[signature(word)].append(word) + word_by_signature[signature(word)].append(word) if __name__ == "__main__": all_anagrams = {word: anagram(word) for word in word_list if len(anagram(word)) > 1}