wiki https en wikipedia orgwikipangram a pangram string contains all the alphabets at least once ispangramthe quick brown fox jumps over the lazy dog true ispangramwaltz bad nymph for quick jigs vex true ispangramjived fox nymph grabs quick waltz true ispangrammy name is unknown false ispangramthe quick brown fox jumps over the lay dog false ispangram true declare frequency as a set to have unique occurrences of letters replace all the whitespace in our sentence ispangramfasterthe quick brown fox jumps over the lazy dog true ispangramfasterwaltz bad nymph for quick jigs vex true ispangramfasterjived fox nymph grabs quick waltz true ispangramfasterthe quick brown fox jumps over the lay dog false ispangramfaster true ispangramfastestthe quick brown fox jumps over the lazy dog true ispangramfastestwaltz bad nymph for quick jigs vex true ispangramfastestjived fox nymph grabs quick waltz true ispangramfastestthe quick brown fox jumps over the lay dog false ispangramfastest true benchmark code comparing different version 5 348480500048026 2 6477354579837993 1 8470395830227062 5 036091582966037 2 644472333951853 1 8869528750656173 a pangram string contains all the alphabets at least once is_pangram the quick brown fox jumps over the lazy dog true is_pangram waltz bad nymph for quick jigs vex true is_pangram jived fox nymph grabs quick waltz true is_pangram my name is unknown false is_pangram the quick brown fox jumps over the la_y dog false is_pangram true declare frequency as a set to have unique occurrences of letters replace all the whitespace in our sentence is_pangram_faster the quick brown fox jumps over the lazy dog true is_pangram_faster waltz bad nymph for quick jigs vex true is_pangram_faster jived fox nymph grabs quick waltz true is_pangram_faster the quick brown fox jumps over the la_y dog false is_pangram_faster true is_pangram_fastest the quick brown fox jumps over the lazy dog true is_pangram_fastest waltz bad nymph for quick jigs vex true is_pangram_fastest jived fox nymph grabs quick waltz true is_pangram_fastest the quick brown fox jumps over the la_y dog false is_pangram_fastest true benchmark code comparing different version 5 348480500048026 2 6477354579837993 1 8470395830227062 5 036091582966037 2 644472333951853 1 8869528750656173
def is_pangram(
    input_str: str = "The quick brown fox jumps over the lazy dog",
) -> bool:
    
    
    frequency = set()

    
    input_str = input_str.replace(" ", "")
    for alpha in input_str:
        if "a" <= alpha.lower() <= "z":
            frequency.add(alpha.lower())
    return len(frequency) == 26


def is_pangram_faster(
    input_str: str = "The quick brown fox jumps over the lazy dog",
) -> bool:
    
    flag = [False] * 26
    for char in input_str:
        if char.islower():
            flag[ord(char) - 97] = True
        elif char.isupper():
            flag[ord(char) - 65] = True
    return all(flag)


def is_pangram_fastest(
    input_str: str = "The quick brown fox jumps over the lazy dog",
) -> bool:
    
    return len({char for char in input_str.lower() if char.isalpha()}) == 26


def benchmark() -> None:
    
    from timeit import timeit

    setup = "from __main__ import is_pangram, is_pangram_faster, is_pangram_fastest"
    print(timeit("is_pangram()", setup=setup))
    print(timeit("is_pangram_faster()", setup=setup))
    print(timeit("is_pangram_fastest()", setup=setup))
    
    


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    benchmark()