Skip to content

Commit 38bb0ad

Browse files
authored
Merge pull request #1 from legaroid/legaroid-add-pangram
Added pangram
2 parents adfa11f + bc4078c commit 38bb0ad

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

P/pangram/pangram.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'''
2+
The code is for checking whether a given input string is a "pangram", that is,
3+
it contains all the letters from A to Z at least once.
4+
Assume the regular English alphabet of 26 letters.
5+
Any extra letters, numbers, punctuation etc are ignored.
6+
7+
Example:
8+
Enter a string: the quick brown fox jumps over the lazy dog
9+
The number is pangram!
10+
'''
11+
12+
def pangram(s):
13+
l = len(s)
14+
letters = set()
15+
for char in s:
16+
if char.isalpha() == True:
17+
letters.add(char.lower())
18+
if len(letters) == 26:
19+
return True
20+
return False
21+
22+
str = input("Enter a string:")
23+
24+
result = pangram(str)
25+
26+
if(result == True):
27+
print("The number is pangram!")
28+
else:
29+
print("Not a pangram!")
30+

0 commit comments

Comments
 (0)