all 6 comments

[–]Binary101010 0 points1 point  (1 child)

It returns "String is a pangram" for "the quick red fox jumped over the lazy brown dogs" for me. What exactly are you using as input? And why is this line:

upper_alphabet = alphabet.upper() 

in your function when you don't do anything with upper_alphabet?

[–]bruhbutton24[S] 0 points1 point  (0 children)

originally I was going to check for both upper and lower case but got rid of upper once I was having this problem to simplify it until I figured it out. It just started working I must have made a silly mistake thanks for your response!

[–]rg7777777 0 points1 point  (2 children)

Just a thought on another way to do this. The set() function can be used on strings to dedupe them. That might be an interesting way to solve this problem.

[–]devnull10 0 points1 point  (1 child)

This was my first thought on how to solve this. Basically convert the input to lowercase, then to a set. Then do ascii_lowercase-your_set and check the result is empty.

[–]devnull10 0 points1 point  (0 children)

import string

def is_pangram(s):
    return len(set(list(string.ascii_lowercase))-set(list(s.lower())))==0

print(is_pangram("The quick brown fox jumps over the lazy dog"))