Pangrams

  • + 0 comments

    The simplest logic in python

    def createAsciModel():
        a=97
        z=122
        res = []
        while(True):
            if(a>z):
                break
            res.append(a)
            a= a+1
        return res
    
    def checkAsciModel(record, asciModel):
        for idx in range(len(asciModel)):
            asci = asciModel[idx]
            if asci == (ord(record)):
                return idx
    def checkPangram(lowerCase, createAsciModel):
        asciModel = createAsciModel
        for records in lowerCase:
            idx = checkAsciModel(records,asciModel)
            if not idx and idx != 0:
                continue
            asciModel.pop(idx)
        return asciModel
    
    def pangrams(s):
        # Write your code here
        lowerCase = s.lower()
        asciModel = createAsciModel()
        pangram = checkPangram(lowerCase, asciModel)
        if len(pangram)>0:
            return 'not pangram'
        return 'pangram'