题解 | #参数解析#

统计大写字母个数

http://www.nowcoder.com/practice/434414efe5ea48e5b06ebf2b35434a9c

法一 用isupper()函数

while True:
try:
s=input()
res=0
for i in s:
if i.isupper():
res+=1
print(res)
except:
break
'''
#法二 用字符串的比大小!>='A' <='Z'
while True:
try:
n = input()
result = 0
for i in n:
if i >= 'A' and i <= 'Z':
result += 1
print(result)
except:
break

法三:用ord() ASCll表 <91 and ord(i)>64

while True:
try:
s = input()
n=0
for i in s:
if ord(i)<91 and ord(i)>64:
n=n+1
print(n)
except:
break
'''

全部评论
哥么🐂*呀!法四用正则表达式
点赞 回复 分享
发布于 2022-03-06 10:49

相关推荐

不知道怎么取名字_:玩游戏都写到简历上了啊
点赞 评论 收藏
分享
白火同学:1、简历可以浓缩成一页,简历简历先要“简”方便HR快速过滤出有效信息,再要“历”用有效信息突出个人的含金量。 2、教育背景少了入学时间~毕业时间,HR判断不出你是否为应届生。 3、如果你的平台账号效果还不错,可以把账号超链接或者用户名贴到对应位置,一是方便HR知道你是具体做了什么内容的运营,看到账号一目了然,二是口说无凭,账号为证,这更有说服力。
面试被问期望薪资时该如何...
点赞 评论 收藏
分享
评论
16
2
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务