专题博客链接
[题解]浙大Python PTA课后习题博客记录(Python)
原题题目
代码实现
string = input();letter = blank = digit = other = count = 0
while count < 10:
for i in string:
if('a'<=i<='z' or 'A'<=i<='Z'):letter+=1
elif('0'<=i<='9'):digit+=1
elif(i== ' '):blank+=1
else:other+=1
count+=1
if(count == 10):break
if(count<10):blank+=1;count+=1;string = input()
print("letter = %d, blank = %d, digit = %d, other = %d"%(letter,blank,digit,other))