import stringdef SlowSnail(s):up = 0low = 0space = 0digit = 0others = 0for c in s:if c.isupper():up += 1elif c.islower():low += 1elif c.isspace():space += 1elif c.isdigit():digit += 1else:others += 1print('大写字母 = %d,小写字母 = %d,空格 = %d,数字 = %d,其他 = %d' % (up, low, space, digit, others))while 1:s = input('请输入一个字符串:\n')if '-1' in s: # 设置退出循环条件breakSlowSnail(s) # 调用函数
1200字范文,内容丰富有趣,写作的好帮手!