199. Python Program to Check If a Sentence Is a Pangram
EasyPhase 1 · Warm-up
You know lower(), for loops and not in. Together they solve this.
Overview
The pangram check is a common interview question about strings. Font designers use pangrams to show every letter of a font.
Problem Statement
Elena tests a new keyboard. Elena types a sentence and wants to know if it uses every letter key.
A pangram is a sentence that uses every letter from a to z at least once. Capital letters count as the same letter: T and t are both the letter t. Spaces, digits and signs do not matter.
Read a sentence. Print This sentence is a pangram or This sentence is not a pangram.
Steps
- Read the sentence and make it lowercase.
- Start by saying it is a pangram.
- Loop over the 26 letters from a to z. If a letter is not in the sentence, it is not a pangram.
- Print the right line.
Examples
Example 1. Input The quick brown fox jumps over the lazy dog gives:
This sentence is a pangram
Why: every letter from a to z is somewhere in the sentence. The capital T counts as a t.
Example 2. Input Hello world gives:
This sentence is not a pangram
Why: many letters are missing, for example a, b and c.
Input
One line of text (1 character or more). Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
Output
One line: This sentence is a pangram or This sentence is not a pangram. The tests try 6 different inputs.
Try it first. The solution opens when you solve this question, or after 3 tries with Submit.