Check Pangram in Python
Check whether a sentence is a pangram (contains every letter of the alphabet at least once).
IntermediateString ProgramsExample 24 of 25
check-pangram.py
Run in browser1# Program to check pangram23import string45sentence = input("Enter a sentence: ").lower()67alphabet_set = set(string.ascii_lowercase)8letters = set(ch for ch in sentence if ch.isalpha())910if alphabet_set.issubset(letters):11 print("Pangram")12else:13 print("Not a pangram")
Output
Enter a sentence: The quick brown fox jumps over the lazy dog Pangram
What's going on
We compare the set of all lowercase letters with the set of letters present in the sentence.