Python Practice › String Programs › Program 63

Does a string contain every letter?

EasyString Programs · 63 of 106

Write a Python program to check whether a string contains all letters of the alphabet (a pangram).

Advertisement
Input
"abcdgjksoug", "The quick brown fox jumps over the lazy dog"
Output
False
True

Approach

  1. Compare the set of letters with string.ascii_lowercase.

Solution

Python
import string for text in ["abcdgjksoug", "The quick brown fox jumps over the lazy dog"]:    print(set(string.ascii_lowercase) <= set(text.lower()))
Output
False
True

Learn the concept

New to this topic? Read the lesson, then come back.

More string programs

← All 106 String Programs

Leave a Comment