Skip to content

Created pangram checker #223

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions P/pangram/pangram.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'''
The code is for checking whether a given input string is a "pangram", that is,
it contains all the letters from A to Z at least once.
Assume the regular English alphabet of 26 letters.
Any extra letters, numbers, punctuation etc are ignored.

Example:
Enter a string: the quick brown fox jumps over the lazy dog
The number is pangram!
'''

def pangram(s):
l = len(s)
letters = set()
for char in s:
if char.isalpha() == True:
letters.add(char.lower())
if len(letters) == 26:
return True
return False

str = input("Enter a string:")

result = pangram(str)

if(result == True):
print("The number is pangram!")
else:
print("Not a pangram!")