Pangrams

Sort by

recency

|

383 Discussions

|

  • + 0 comments

    Python Modify string s to lower case and eliminate white space. Add to a set() that cannot have a duplicate. Compare its size

    def pangrams(s):
        # Write your code here
        s = set(''.join(s.lower().split()))
        return 'pangram' if len(s) == 26 else 'not pangram'
    
  • + 0 comments

    Scala

    def pangrams(s: String): String = {
            val cleansedString = s.toLowerCase().trim().distinct
            val cleansedAsciiArray = cleansedString.map(_.toInt).toArray
            
            val asciiArray = ('a'.toInt to 'z'.toInt).toArray
            
            val isPangram = asciiArray.intersect(cleansedAsciiArray).length == 26
            if(isPangram) "pangram" else "not pangram"
        }
    
  • + 0 comments

    Simple for loop :

    def pangrams(s):
        alph = "abcdefghijklmnopqrstuvwxyz"
        for i in alph:
            if i not in s.lower():
                return "not pangram"
        return "pangram"
    
  • + 0 comments
    def pangrams(s):
        # Write your code here
        alp='abcdefghijklmnopqrstuvwxyz'
        l=len(set(s.lower().replace(" ","")))
        # print(l) 
        for i in alp:
            if i in set(s.lower().replace(" ","")) and l==26:
                return 'pangram'
            else:
                return 'not pangram'
    
  • + 0 comments
    • def pangrams(s):
    • Write your code here

    • alp='abcdefghijklmnopqrstuvwxyz'
    • l=len(set(s.lower().replace(" ","")))
    • print(l)

    • for i in alp:
    • if i in set(s.lower().replace(" ","")) and l==26:
    • return 'pangram'
    • else:
    • return 'not pangram'