Sort by

recency

|

1932 Discussions

|

  • + 0 comments

    def pangrams(s):

    # Write your code here
    pangram='abcdefghijklmnopqrstuvwxyz'
    l=set([i.lower() for i in s if i != ' '])
    
    if len(l)==len(pangram):
        return 'pangram'
    else:
        return 'not pangram' 
    
  • + 0 comments

    Here is my c++ solution, you can watch the explanation here : https://youtu.be/-8w6U6qPNrA

    #include <bits/stdc++.h>
    
    using namespace std;
    
    int main()
    {
        string s;
        getline(cin, s);
        vector<int> c(26, 0);
        for(int i = 0; i < s.size(); i++){
            if(s[i] != ' ')
            c[tolower(s[i]) - 'a']++;
        }
        string r = "pangram";
        for(int i = 0; i < c.size(); i++){
            if(c[i] == 0){
                r = "not " + r;
                break;
            }
        }
        cout << r ;
        return 0;
    }
    
  • + 0 comments

    Here is my Python solution using a Counter!

    def pangrams(s):
        s = [letter.lower() for letter in s if letter.isalpha()]
        return "pangram" if len(Counter(s)) == 26 else "not pangram"
    
  • + 0 comments

    python3 1 line solution:

    def pangrams(s):
        return "pangram" if len(list(set((s.replace(" ","").lower())))) == 26 else "not pangram"
    
  • + 0 comments

    s=input().lower() import string for i in string.ascii_lowercase: if i not in s: print('not pangram') break else: print('pangram')