Below is a Python program that determines the count of non-pangrams, pangrams, and perfect pangrams from a list of strings. A pangram contains every letter of the English alphabet at least once, while a perfect pangram contains each letter exactly once (ignoring case and non-letter characters).
def is_pangram(text):
# Convert to lowercase and filter only alphabetic characters
alphabet = set(char.lower() for char in text if char.isalpha())
# Check if all 26 letters are present
return len(alphabet) == 26
def is_perfect_pangram(text):
# Convert to lowercase and filter only alphabetic characters
alphabet = set(char.lower() for char in text if char.isalpha())
# Check if exactly 26 unique letters are present
return len(alphabet) == 26 and len(set(text.lower())) == 26
def count_pangram_types(string_list):
non_pangrams = 0
pangrams = 0
perfect_pangrams = 0
for string in string_list:
if not is_pangram(string):
non_pangrams += 1
elif is_perfect_pangram(string):
perfect_pangrams += 1
else:
pangrams += 1
return non_pangrams, pangrams, perfect_pangrams
# Example usage with a small list (replace with your 1,000 strings)
test_strings = [
"The quick brown fox jumps over a lazy dog",
"Mr Jock, TV quiz PhD, bags few lynx",
"Hello world"
]
non_p, pang, perf_pang = count_pangram_types(test_strings)
print(f"Non-pangrams: {non_p}")
print(f"Pangrams: {pang}")
print(f"Perfect pangrams: {perf_pang}")