Python 字符串大写字母计数函数
def count(s): count = 0 for i in s: if i.isupper(): count += 1 return count
s = input('请输入一个字符串:') print(f'字符串 '{s}' 中包含 {count(s)} 个大写字母。')
原文地址: https://www.cveoy.top/t/topic/oztK 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
def count(s): count = 0 for i in s: if i.isupper(): count += 1 return count
s = input('请输入一个字符串:') print(f'字符串 '{s}' 中包含 {count(s)} 个大写字母。')
原文地址: https://www.cveoy.top/t/topic/oztK 著作权归作者所有。请勿转载和采集!