Skip to content

[Fix bug] Fix check_pangram_faster in check_pangram.py #4389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions strings/check_pangram.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def check_pangram_faster(
"""
>>> check_pangram_faster("The quick brown fox jumps over the lazy dog")
True
>>> check_pangram("Waltz, bad nymph, for quick jigs vex.")
>>> check_pangram_faster("Waltz, bad nymph, for quick jigs vex.")
True
>>> check_pangram("Jived fox nymph grabs quick waltz.")
>>> check_pangram_faster("Jived fox nymph grabs quick waltz.")
True
>>> check_pangram_faster("The quick brown fox jumps over the la_y dog")
False
Expand All @@ -50,7 +50,9 @@ def check_pangram_faster(
flag = [False] * 26
for char in input_str:
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)


Expand Down