源程序:
print("请输入一串字符(包含大小写字母、数字和其他字符):")标签:字符,elif,数字,小写字母,字母,个数,num,特殊字符,upp From: https://www.cnblogs.com/duanqibo/p/18100736
str1 = input()
upp_num = 0
low_num = 0
digit = 0
other = 0
for i in str1:
if "a" <= i <= "z":
low_num += 1
elif "A" <= i <= "Z":
upp_num += 1
elif "0" <= i <= "9":
digit += 1
else:
other += 1
print("小写字母 :", low_num, " 个。", "\n大写字母:", upp_num, " 个。")
print("\n数字 :", digit, " 个。", "\n其他字符:", other, " 个。")