How to check if a string is pangram in Python

1 Answer

0 votes
# A string is a pangram if it contains all the characters of the alphabet ignoring case

from string import ascii_lowercase as asc_lower

def check_pangram(s):
    return set(asc_lower) - set(s.lower()) == set([])
    
s = "The quick brown fox jumps over the lazy dog"


if (check_pangram(s) == True):
      print("The string is a pangram")
else:
      print("The string isn't a pangram")
      
   
      
'''
run:

The string is a pangram

'''

 



answered Sep 13, 2023 by avibootz
edited Sep 14, 2023 by avibootz

Related questions

1 answer 125 views
125 views asked Sep 14, 2023 by avibootz
1 answer 123 views
123 views asked Sep 14, 2023 by avibootz
1 answer 138 views
138 views asked Sep 14, 2023 by avibootz
1 answer 117 views
1 answer 104 views
104 views asked Sep 14, 2023 by avibootz
1 answer 111 views
...