From d2839650b6572dedc405c0bc8e849cf4a84119ba Mon Sep 17 00:00:00 2001 From: Farhan Ahmad Date: Sat, 3 Jan 2026 22:08:26 +0500 Subject: [PATCH 1/6] docs: add check_pangram with doctests Implement a function to check if a string is a pangram. --- strings/check_pangram.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 strings/check_pangram.py diff --git a/strings/check_pangram.py b/strings/check_pangram.py new file mode 100644 index 000000000000..5ea15aa65104 --- /dev/null +++ b/strings/check_pangram.py @@ -0,0 +1,16 @@ +def check_pangram(input_str: str) -> bool: + """ + Check if a string is a pangram (contains every letter of the alphabet). + >>> check_pangram("The quick brown fox jumps over the lazy dog") + True + >>> check_pangram("Hello World") + False + >>> check_pangram("") + False + """ + return len(set(c for c in input_str.lower() if c.isalpha())) == 26 + + +if __name__ == "__main__": + import doctest + doctest.testmod() From a76637bea13b2207e6a7eacc6fc08f44cd21e8f8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 3 Jan 2026 17:10:43 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- strings/check_pangram.py | 1 + 1 file changed, 1 insertion(+) diff --git a/strings/check_pangram.py b/strings/check_pangram.py index 5ea15aa65104..ca5136c0f92a 100644 --- a/strings/check_pangram.py +++ b/strings/check_pangram.py @@ -13,4 +13,5 @@ def check_pangram(input_str: str) -> bool: if __name__ == "__main__": import doctest + doctest.testmod() From 0674c029a408e542c394b08e627d69693002bbb7 Mon Sep 17 00:00:00 2001 From: Farhan Ahmad Date: Sat, 3 Jan 2026 22:23:49 +0500 Subject: [PATCH 3/6] Refactor check_pangram.py to remove duplicate import Removed duplicate import of doctest and added a newline at the end of the file. --- strings/check_pangram.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/strings/check_pangram.py b/strings/check_pangram.py index ca5136c0f92a..1c37eeec8409 100644 --- a/strings/check_pangram.py +++ b/strings/check_pangram.py @@ -1,3 +1,7 @@ +import doctest + + + def check_pangram(input_str: str) -> bool: """ Check if a string is a pangram (contains every letter of the alphabet). @@ -12,6 +16,5 @@ def check_pangram(input_str: str) -> bool: if __name__ == "__main__": - import doctest - doctest.testmod() + From deab96b912319a721ba34ebac35c6aee0e4b66de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 3 Jan 2026 17:24:14 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- strings/check_pangram.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/strings/check_pangram.py b/strings/check_pangram.py index 1c37eeec8409..d84b51a25146 100644 --- a/strings/check_pangram.py +++ b/strings/check_pangram.py @@ -1,7 +1,6 @@ import doctest - def check_pangram(input_str: str) -> bool: """ Check if a string is a pangram (contains every letter of the alphabet). @@ -17,4 +16,3 @@ def check_pangram(input_str: str) -> bool: if __name__ == "__main__": doctest.testmod() - From dd1eb2752dbe838a8c6feaea13525ee860bfd738 Mon Sep 17 00:00:00 2001 From: Farhan Ahmad Date: Sat, 3 Jan 2026 22:27:19 +0500 Subject: [PATCH 5/6] Refactor pangram check to use set comparison --- strings/check_pangram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings/check_pangram.py b/strings/check_pangram.py index d84b51a25146..48aceae3ec17 100644 --- a/strings/check_pangram.py +++ b/strings/check_pangram.py @@ -11,7 +11,7 @@ def check_pangram(input_str: str) -> bool: >>> check_pangram("") False """ - return len(set(c for c in input_str.lower() if c.isalpha())) == 26 + return {c for c in input_str.lower() if c.isalpha()} == set("abcdefghijklmnopqrstuvwxyz") if __name__ == "__main__": From f74dcbe6102ea881966a08cf275aad03bb765ffc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 3 Jan 2026 17:27:38 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- strings/check_pangram.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/strings/check_pangram.py b/strings/check_pangram.py index 48aceae3ec17..a351fd211047 100644 --- a/strings/check_pangram.py +++ b/strings/check_pangram.py @@ -11,7 +11,9 @@ def check_pangram(input_str: str) -> bool: >>> check_pangram("") False """ - return {c for c in input_str.lower() if c.isalpha()} == set("abcdefghijklmnopqrstuvwxyz") + return {c for c in input_str.lower() if c.isalpha()} == set( + "abcdefghijklmnopqrstuvwxyz" + ) if __name__ == "__main__":