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
33 changes: 31 additions & 2 deletions pangram/pangram.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
def is_pangram(sentence):
pass
"""
Pangram.

You work for a company that sells fonts through their website. They'd like to
show a different sentence each time someone views a font on their website.
To give a comprehensive sense of the font, the random sentences should use
all the letters in the English alphabet.

They're running a competition to get suggestions for sentences that they can
use. You're in charge of checking the submissions to see if they are valid.
"""


def is_pangram(sentence: str) -> bool:
"""
Verify that the random sentences uses all the letters in the English.

:param sentence: The sentence to check for pangram validity
:type sentence: str
:return: True if the sentence contains all 26 letters of the English,
False otherwise
:rtype: bool
"""
# Empty string
if not sentence:
return False
# Convert sentence to lowercase and extract unique alphabetic characters
unique_letters: set = set(
char for char in sentence.lower() if char.isalpha()
)
return len(unique_letters) == 26
2 changes: 2 additions & 0 deletions pangram/pangram_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pylint: disable=C0114, C0115, C0116, R0904

# These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/pangram/canonical-data.json
# File last updated on 2023-07-19
Expand Down
2 changes: 2 additions & 0 deletions solutions/python/pangram/1/pangram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def is_pangram(sentence):
pass