Pangrams

Sort by

recency

|

219 Discussions

|

  • + 0 comments

    my JavaScript solution

    function pangrams(s) {
        const isPangram = s => new Set(s.toLowerCase().match(/[a-z]/g)).size === 26 ? "pangram" : "not pangram";
        
        return isPangram(s);
    
    }
    
  • + 0 comments

    Python 3 solutions:

    import string
    import typing
    
    
    ALPHABET: set[str] = {*string.ascii_uppercase}
    
    
    def pangrams(s: str) -> typing.Literal["pangram", "not pangram"]:
        return "pangram" if {*s.upper()} >= ALPHABET else "not pangram"
    
    
    def pangrams(s: str) -> typing.Literal["pangram", "not pangram"]:
        return "not pangram"[4 * (len({*s.upper().replace(" ", "")}) == 26) :]
    
    
    pangrams=lambda s:(len({*s.upper()}-{" "})<26)*"not "+"pangram"  # 63
    
  • + 0 comments
    def pangrams(s):
        # Write your code here
        if not (set(string.ascii_lowercase) - set(s.lower())):
            return "pangram"
        return "not pangram"
    
  • + 0 comments

    My TypeScript solution:

    function pangrams(s: string): string {
        const alphabet = "abcdefghijklmnopqrstuvwxyz";
        const ALPH_LENGTH = 26;
        
        for (let i = 0; i < ALPH_LENGTH; i++) {
            if (!s.toLocaleLowerCase().includes(alphabet[i])) 
                return "not pangram";
        }
        
        return "pangram";
    
    }
    
  • + 0 comments

    python 3

    def pangrams(s):
            return "pangram" if 26 == len(set([x for x in s.lower() if x.isalpha()])) else "not pangram"