520. Detect Capital

来源:互联网 发布:天津青蛙网络 编辑:程序博客网 时间:2024/06/05 16:45
class Solution(object):    def detectCapitalUse(self, word):        """        :type word: str        :rtype: bool        """        word_temp = word[1:];        if (word.lower() == word):            return True;        if (word.upper() == word):            return True;        if (len(word)>1 and (word_temp.lower() == word_temp) and (word[0].upper() == word[0])):            return True;        else:            return False;    
def detectCapitalUse(self, word):    return word.isupper() or word.islower() or word.istitle();
0 0