-
Notifications
You must be signed in to change notification settings - Fork 9
/
Pangrams.py
54 lines (35 loc) · 1.07 KB
/
Pangrams.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
A pangram is a string that contains every letter of the alphabet. Given a sentence determine whether it is a pangram in the English alphabet. Ignore case. Return either pangram or not pangram as appropriate.
Sample Input 0
We promptly judged antique ivory buckles for the next prize
Sample Output 0
pangram
Sample Explanation 0
All of the letters of the alphabet are present in the string.
Sample Input 1
We promptly judged antique ivory buckles for the prize
Sample Output 1
not pangram
Sample Explanation 0
The string lacks an x.
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the pangrams function below.
l=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
def pangrams(s):
x=set(s.lower())
if " " in x:
x.remove(" ")
if sorted(x)==l:
return("pangram")
else:
return("not pangram")
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
s = input()
result = pangrams(s)
fptr.write(result + '\n')
fptr.close()