Check Pangram

Check whether a sentence is a pangram (contains every letter of the alphabet at least once).

PythonIntermediate
Python
# Program to check pangram

import string

sentence = input("Enter a sentence: ").lower()

alphabet_set = set(string.ascii_lowercase)
letters = set(ch for ch in sentence if ch.isalpha())

if alphabet_set.issubset(letters):
    print("Pangram")
else:
    print("Not a pangram")

Output

Enter a sentence: The quick brown fox jumps over the lazy dog
Pangram

We compare the set of all lowercase letters with the set of letters present in the sentence.