标签:color input 字母 nbsp int lower inpu 输入 ret
1 def count(n): 2 upp = 0 3 low = 0 4 num = 0 5 sym = 0 6 for i in n: 7 if i.isupper(): 8 upp +=1 9 elif i.islower(): 10 low +=1 11 elif i.isdigit(): 12 num +=1 13 else: 14 sym +=1 15 return "大写字母的个数是:{0}\n小写字母的个数是:{1}\n数字的个数是:{2}\n符号的个数是:{3}".format(upp,low,num,sym) 16 print(count(input("请输入字符串:")))
标签:color input 字母 nbsp int lower inpu 输入 ret
原文地址:https://www.cnblogs.com/NoteBook3013/p/10197530.html