从键盘中任意输入一串字符,直至输入"#"字符代表结束.请编程统计输入的字符中的大写字母,小写字母和数字字符的个数分别是多少?
怎们用python做
n=0
a=0
A=0
s=input("")
for c in s:
if c=='#':
break
if c>='0' and c<='9':
n=n+1
elif c>='a' and c<='z':
a=a+1
elif c>='A' and c<='Z':
A=A+1
print(n,a,A)
nums = upper = lower = 0
ss = ''
while True:
s = input()
if s=='#': break
ss += s
for i in ss:
if i.isdigit():
nums += 1
elif i.isupper():
upper += 1
elif i.islower():
lower += 1
print('大写字母:',upper)
print('小写字母:',lower)
print('数字字符:',nums)