25 XP

40. Pangram

Beginner sets strings

A pangram is a sentence that uses every letter of the alphabet at least once, like "The quick brown fox jumps over the lazy dog". Typists use them to try out every key.

Write a function is_pangram(sentence) that takes a string and returns True if every letter from a to z appears in it at least once, or False if any letter is missing.

  • Ignore case: A and a are the same letter.
  • Other characters (spaces, digits, punctuation) don't matter either way.
  • An empty sentence uses no letters, so it isn't a pangram.

Example 1

Inputsentence = "Sphinx of black quartz, judge my vow"
OutputTrue
ExplanationAll 26 letters appear, some more than once.

Example 2

Inputsentence = "abcdefghijklmnopqrstuvwxy"
OutputFalse
ExplanationThe letter z is missing.

Constraints

  • sentence has 0 to 200 characters: English letters, digits, spaces and punctuation.

Submit also runs 7 more tests you can't see.

Practises Sets (lesson 12).

Code
def is_pangram(sentence):
    """Check whether sentence uses every letter a to z.

    sentence: str, any text; may be empty
    Returns: bool, True if all 26 letters appear (in any
        case), else False
    """
    # Write your code here
    pass