File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ def is_pangram(
1818 False
1919 >>> is_pangram("The quick brown fox jumps over the la_y dog")
2020 False
21+ >>> is_pangram("abcdefghijklmnopqrstuvwxy\\ u00e9")
22+ False
2123 >>> is_pangram()
2224 True
2325 """
@@ -44,15 +46,16 @@ def is_pangram_faster(
4446 True
4547 >>> is_pangram_faster("The quick brown fox jumps over the la_y dog")
4648 False
49+ >>> is_pangram_faster("abcdefghijklmnopqrstuvwxy\\ u00e9")
50+ False
4751 >>> is_pangram_faster()
4852 True
4953 """
5054 flag = [False ] * 26
5155 for char in input_str :
52- if char .islower ():
53- flag [ord (char ) - 97 ] = True
54- elif char .isupper ():
55- flag [ord (char ) - 65 ] = True
56+ lower_char = char .lower ()
57+ if "a" <= lower_char <= "z" :
58+ flag [ord (lower_char ) - 97 ] = True
5659 return all (flag )
5760
5861
@@ -68,10 +71,12 @@ def is_pangram_fastest(
6871 True
6972 >>> is_pangram_fastest("The quick brown fox jumps over the la_y dog")
7073 False
74+ >>> is_pangram_fastest("abcdefghijklmnopqrstuvwxy\\ u00e9")
75+ False
7176 >>> is_pangram_fastest()
7277 True
7378 """
74- return len ({char for char in input_str .lower () if char . isalpha () }) == 26
79+ return len ({char for char in input_str .lower () if "a" <= char <= "z" }) == 26
7580
7681
7782def benchmark () -> None :
You can’t perform that action at this time.
0 commit comments