Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ If you want to uninstall algorithms, it is as simple as:
- [judge_circle](algorithms/strings/judge_circle.py)
- [strong_password](algorithms/strings/strong_password.py)
- [caesar_cipher](algorithms/strings/caesar_cipher.py)
- [check_pangram](algorithms/strings/check_pangram.py
- [contain_string](algorithms/strings/contain_string.py)
- [count_binary_substring](algorithms/strings/count_binary_substring.py)
- [repeat_string](algorithms/strings/repeat_string.py)
Expand Down
1 change: 1 addition & 0 deletions algorithms/strings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from .judge_circle import *
from .strong_password import *
from .caesar_cipher import *
from .check_pangram import *
from .contain_string import *
from .count_binary_substring import *
from .repeat_string import *
Expand Down
10 changes: 10 additions & 0 deletions algorithms/strings/check_pangram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
Algorithm that checks if a given string is a pangram or not
"""

def check_pangram(input_string):
alphabet = "abcdefghijklmnopqrstuvwxyz"
for ch in alphabet:
if ch not in input_string.lower():
return False
return True
6 changes: 6 additions & 0 deletions tests/test_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
judge_circle,
strong_password,
caesar_cipher,
check_pangram,
contain_string,
count_binary_substring,
repeat_string,
Expand Down Expand Up @@ -454,6 +455,11 @@ def test_caesar_cipher(self):
self.assertEqual("Lipps_Asvph!", caesar_cipher("Hello_World!", 4))
self.assertEqual("okffng-Qwvb", caesar_cipher("middle-Outz", 2))

class TestCheckPangram(unittest.TestCase):
def test_check_pangram(self):
self.assertTrue(check_pangram("The quick brown fox jumps over the lazy dog"))
self.assertFalse(check_pangram("The quick brown fox"))


class TestContainString(unittest.TestCase):
def test_contain_string(self):
Expand Down