4条回答 默认 最新
- CSDN专家-sinJack 2022-09-28 13:47关注
s=input('请输入一行字符串:') b,l,n=0,0,0 for c in s: if c.islower(): l+=1 elif c.isupper(): b+=1 elif c.isdigit(): n+=1 print("大写字母个数%d,小写字符个数%d,数字个数%d"%(b,l,n))本回答被题主选为最佳回答 , 对您是否有帮助呢?评论 打赏 举报 编辑记录解决 1无用
s=input('请输入一行字符串:')
b,l,n=0,0,0
for c in s:
if c.islower():
l+=1
elif c.isupper():
b+=1
elif c.isdigit():
n+=1
print("大写字母个数%d,小写字符个数%d,数字个数%d"%(b,l,n))