mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-31 06:33:44 +00:00
Create check_pangram.py (#4389)
This commit is contained in:
parent
6f21f76696
commit
727341e3db
|
@ -38,9 +38,9 @@ def check_pangram_faster(
|
||||||
"""
|
"""
|
||||||
>>> check_pangram_faster("The quick brown fox jumps over the lazy dog")
|
>>> check_pangram_faster("The quick brown fox jumps over the lazy dog")
|
||||||
True
|
True
|
||||||
>>> check_pangram("Waltz, bad nymph, for quick jigs vex.")
|
>>> check_pangram_faster("Waltz, bad nymph, for quick jigs vex.")
|
||||||
True
|
True
|
||||||
>>> check_pangram("Jived fox nymph grabs quick waltz.")
|
>>> check_pangram_faster("Jived fox nymph grabs quick waltz.")
|
||||||
True
|
True
|
||||||
>>> check_pangram_faster("The quick brown fox jumps over the la_y dog")
|
>>> check_pangram_faster("The quick brown fox jumps over the la_y dog")
|
||||||
False
|
False
|
||||||
|
@ -50,7 +50,9 @@ def check_pangram_faster(
|
||||||
flag = [False] * 26
|
flag = [False] * 26
|
||||||
for char in input_str:
|
for char in input_str:
|
||||||
if char.islower():
|
if char.islower():
|
||||||
flag[ord(char) - ord("a")] = True
|
flag[ord(char) - 97] = True
|
||||||
|
elif char.isupper():
|
||||||
|
flag[ord(char) - 65] = True
|
||||||
return all(flag)
|
return all(flag)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user