【python】python统计字符串中小写字母的个数
Bat是一个淘气的小朋友,有一天他得到了一个字符串,他想统计一下字符串中的小写字母(‘a’-’z’)的个数,快来帮帮他吧。
·
list = ["a", "b", "d","c","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s =input()
num = 0
for item in list:
num += s.count(item)
print(num)
更多推荐
所有评论(0)