non-pangram: 819
pangram: 132
perfect pangram: 49
def classify_string(s: str) -> str:
alphabet = set("azertyuiopqsdfghjklmwxcvbn")
input_filter_lower = [c.lower() for c in s if c.isalpha()]
input_set =if len(set(input_filter_lower)
if) not!= alphabet.issubset(input_set)26:
return "non-pangram"
return "perfect pangram" if len(input_filter_lower) == 26 else "pangram"
if __name__ == "__main__":
for k, v in {k: sum(classify_string(s)==k for s in open("List of 1000 strings.json").read().splitlines()[1:-1]) for k in ["non-pangram","pangram","perfect pangram"]}.items():
print(f"{k}: {v}")
Tried my best to write my code as short as possible with keeping it still be readable.
A nice quick challenge to wake up my coding skills.