输入一段字符,统计一段字符串大小写字母的个数-python
#输入一段字符,统计一段字符串大小写字母的个数
def num(s):
num_min=0
num_max=0
for i in s:
if i.islower():
num_min=num_min+1
elif i.isupper():
num_max=num_max+1
return(num_min,num_max)
s1=input('请输入字符串:')
a=num(s1)
print(a,type(a))
print("小写字母的个数是:",a[0],"\n大写字母的个数是:",a[1] )
本文介绍如何使用Python编程语言实现统计输入字符串中大写字母和小写字母的个数,通过函数`num()`演示步骤并提供实例。
7658

被折叠的 条评论
为什么被折叠?



