输入一个字符串,统计其中数字字符及小写字符的个数
实现
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
def method_1():
numCount=0
chCount=0
s=input()
for temp in s:
if temp.isnumeric():
numCount+=1
if temp.islower():
chCount+=1
print(f"共有{numCount}个数字,{chCount}个小写字符")
#-----
method_1()
输出
skdggsd23as3e3
共有4个数字,10个小写字符
Q.E.D.