Last active
June 28, 2017 20:02
-
-
Save awmpietro/9faa53fd98a23ef95777facde4718b22 to your computer and use it in GitHub Desktop.
Pangram function in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| ** Check is a given string is a Pangram (https://en.wikipedia.org/wiki/Pangram) | |
| ** @params string | |
| ** @return bool | |
| */ | |
| def is_pangram( str ): | |
| abc = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x' ,'y', 'w', 'z'] | |
| abcClone = list(abc) | |
| str = ''.join(str.split()) | |
| for l in str: | |
| if l in abc: | |
| if l in abcClone: | |
| abcClone.remove(l) | |
| else: | |
| return False | |
| if len(abcClone) == 0: | |
| return True | |
| return False | |
| //Example: | |
| print(is_pangram('abcdefghijklmnopqrtuvxzwy')) // True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment