Skip to content

Added pangram #1

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 22, 2023
Merged
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!")