from string import ascii_lowercase
ALPHABET = set(ascii_lowercase)
def is_pangram(sentence):
return ALPHABET.issubset(sentence.lower())
In this approach a set is made from the ascii_lowercase letters,
and another set
is made from the lower
cased letters in the sentence
.
The function returns if the alphabet set
issubset() of the sentence
set
.
If all of the letters in the alphabet are a subset of the letters in the sentence
,
then the function will return True
.
13th Nov 2024
·
Found it useful?