Write a function to determine if a sentence is a \"pangram\" or not. A pangram,
ID: 3839350 • Letter: W
Question
Write a function to determine if a sentence is a "pangram" or not. A pangram, also known as a "holoalphabetic sentence" is a sentence that contains every letter of the alphabet. Here are some example pangrams: The quick brown fox jumps over the lazy dog. A very bad quack might jinx zippy fowls. Pack my box with five dozen liquor jugs. As you can see, it does not matter if the letters are upper or lower case, and of course spaces and punctuation are ignored. The function header must exactly match the following: def isPangram(sentence): Return (don't print) True if the sentence is a pangram, or return False if it is not. Test your function in the Python shell. Here are sample tests of our solution: >>> from project2 import is Pangram >>>is Pangram ("Quick brown fox jumps over the lazy dog.") True >>> is Pangram ("Quick brown fox trips over the sly dog.") False >>>answer = isPangram ("abcdefghijklmnopqrstuvwxyz") >>>print (answer) # note: depends on returned value TrueExplanation / Answer
#!/usr/bin/python
def isPangram(sentence):
result = "True"
list = []
for i in range(65,91):
list.append(i)
for i in range(97,123):
list.append(i)
x = sentence
for i in range(0, len(x)):
y = ord(x[i])
for j in range(0,len(list):
if list[j] == y:
list[j] = 0
for i in range(0,len(list)):
if list[i] != 0:
result = "False"
return result
if __name__ == "__main__":
sentence = input("Enter Sentence")
print(isPangram(sentence))
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.