Skip to content

Commit 7899a28

Browse files
committed
Update pangram.py
1 parent f5ec96e commit 7899a28

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

pangram/pangram.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
def is_pangram(sentence):
2-
pass
1+
"""
2+
Pangram.
3+
4+
You work for a company that sells fonts through their website. They'd like to show a
5+
different sentence each time someone views a font on their website. To give a
6+
comprehensive sense of the font, the random sentences should use all the letters
7+
in the English alphabet.
8+
9+
They're running a competition to get suggestions for sentences that they can use.
10+
You're in charge of checking the submissions to see if they are valid.
11+
"""
12+
import string
13+
14+
letters: str = string.ascii_lowercase
15+
16+
17+
def is_pangram(sentence: str) -> bool:
18+
"""
19+
Verify that the random sentences uses all the letters in the English alphabet.
20+
21+
:param sentence: The sentence to check for pangram validity
22+
:type sentence: str
23+
:return: True if the sentence contains all 26 letters of the English alphabet, False otherwise
24+
:rtype: bool
25+
"""
26+
sentence = sentence.lower()
27+
return all(char in letters for char in sentence if char.isalpha())

0 commit comments

Comments
 (0)