题解 | #统计大写字母个数#
统计大写字母个数
https://www.nowcoder.com/practice/434414efe5ea48e5b06ebf2b35434a9c
stri = input() counter = 0 for i in stri: if 'A' <= i <= 'Z': # python 可以直接链式比较,即中间不需要and,要注意<和>的方向 counter += 1 print(counter)
统计大写字母个数
https://www.nowcoder.com/practice/434414efe5ea48e5b06ebf2b35434a9c
stri = input() counter = 0 for i in stri: if 'A' <= i <= 'Z': # python 可以直接链式比较,即中间不需要and,要注意<和>的方向 counter += 1 print(counter)
相关推荐