--

python challenge

A pangram

A pangram is a sentence that contains every single letter of the alphabet at least once. For example, the sentence “The quick brown fox jumps over the lazy dog” is a pangram, because it uses the letters A-Z at least once (case is irrelevant). Given a string, detect whether or not it is a pangram. Return True if it is, False if not. Ignore numbers and punctuation.

solution:

def is_pangram(st):
# Convert the string to lowercase and filter only the alphabetic characters
letters = set(char.lower() for char in st if char.isalpha())
# Check if the set of letters contains all 26 letters of the alphabet
return len(letters) == 26

--

--

TechVerse Chronicles
TechVerse Chronicles

Written by TechVerse Chronicles

Python learner, experienced banker, dedicated father, and loving son, on a journey of growth and discovery. Passionate about coding and family life.

No responses yet