-
Notifications
You must be signed in to change notification settings - Fork 0
/
1832.py
34 lines (21 loc) · 823 Bytes
/
1832.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
"""
pangram is a sentence where every letter of the English alphabet appears at least once.
Given a string sentence containing only lowercase English letters, return true if sentence is a pangram, or false otherwise.
Example 1:
Input: sentence = "thequickbrownfoxjumpsoverthelazydog"
Output: true
Explanation: sentence contains at least one of every letter of the English alphabet.
Example 2:
Input: sentence = "leetcode"
Output: false
"""
class Solution:
def checkIfPangram(self, sentence: str) -> bool:
alphabet = {}
for char in sentence:
if alphabet.get(char) is None:
alphabet[char] = 1
else:
alphabet[char] += 1
return len(alphabet) == 26
print(Solution().checkIfPangram(sentence="thequickbrownfoxjumpsoverthelazydog"))