From d0ab3f8d1ee4a9d9feb840a2d92dde28b9f774fd Mon Sep 17 00:00:00 2001 From: Spooghetti420 Date: Tue, 1 Aug 2023 12:01:40 +0100 Subject: [PATCH] Fix non-idempotence bug --- bulgarian-anagrams/bg-anagrams.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bulgarian-anagrams/bg-anagrams.py b/bulgarian-anagrams/bg-anagrams.py index 78f83bd..71dd71d 100644 --- a/bulgarian-anagrams/bg-anagrams.py +++ b/bulgarian-anagrams/bg-anagrams.py @@ -78,7 +78,7 @@ def add_anagrams(contents: str, anagrams_to_add: set[str], alphagram): existing.add(str(anagrams_template.get(i))) i += 1 - if existing == anagrams_to_add: + if existing.union(anagrams_to_add) == existing: # If there are no new anagrams present return contents anagrams_to_add = anagrams_to_add.union(existing)