Detect Capital - Solution


  • 0
    P

    """

       if len(word) == 1:
            return True
        
        elif word[0].isupper():
            if word[1].isupper():
                for char in word[2:]:
                    if char.islower():
                        return False
                return True   
            elif word[1].islower():
                for char in word[2:]:
                    if char.isupper():  
                        return False
                return True
        
        else:
            for char in word[1:]:
                    if char.isupper():
                        return False
            return True       
    

    """


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.