def count(): voc = input("请输入一串字符:") alist = [0, 0, 0, 0] # 四项数字依次为大写字母、小写字母、数字、其他字符的个数 for i in voc: if 'A' <= i <= 'Z': alist[0] += 1 elif 'a' <= i <= 'z': alist[1] += 1 elif '0' <= i <= '9': alist[2] += 1 else: alist[3] += 1 info_tuple = tuple(alist) print("大写字母、小写字母、数字、其他字符的个数分别为:") print(info_tuple) count()