Python 字符串小写字符计数:高效算法实现
s=input('请输入一个字符串:') count=0 i=0 while i<len(s): if s[i].islower(): count+=1 i+=1 #使用复合数值运算符+=、-=、*=、/=等 print('字符串中共有{}个小写字符'.format(count))
原文地址: https://www.cveoy.top/t/topic/oKg8 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
s=input('请输入一个字符串:') count=0 i=0 while i<len(s): if s[i].islower(): count+=1 i+=1 #使用复合数值运算符+=、-=、*=、/=等 print('字符串中共有{}个小写字符'.format(count))
原文地址: https://www.cveoy.top/t/topic/oKg8 著作权归作者所有。请勿转载和采集!