标签:upper col return div == type class ase case
送分题.
# 送分题 class Solution(object): def detectCapitalUse(self, word): """ :type word: str :rtype: bool """ if len(word)==1: return True ans=True if self.is_uppercase(word[0]): if self.is_uppercase(word[1]): for c in word[1:]: if self.is_lowercase(c): return False else: for c in word[1:]: if self.is_uppercase(c): return False return True else: # the first letter is lowercase for c in word[1:]: if self.is_uppercase(c): return False return True def is_uppercase(self,letter): return (letter>=‘A‘)&(letter<=‘Z‘) def is_lowercase(self,letter): return (letter>=‘a‘)&(letter<=‘z‘)
标签:upper col return div == type class ase case
原文地址:https://www.cnblogs.com/zywscq/p/10504057.html