Skip to content

Instantly share code, notes, and snippets.

@awmpietro
Last active June 28, 2017 20:02
Show Gist options
  • Select an option

  • Save awmpietro/9faa53fd98a23ef95777facde4718b22 to your computer and use it in GitHub Desktop.

Select an option

Save awmpietro/9faa53fd98a23ef95777facde4718b22 to your computer and use it in GitHub Desktop.
Pangram function in Python
/*
** 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