set with issubset

Pangramme
Pangramme dans le parcours Python
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 lowercased 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.

23e Sep 2026 · Tu l'as trouvée utile ?