给点思路吧,真的不懂Python

输入一串字符,分别统计出其中英文字母、空格、数字和其他字符的个数。。

s = input("请输入字符串: ")
letters = 0
space = 0
digit = 0
others = 0

for c in s:
    if c.isalpha():
        letters += 1
    elif c.isspace():
        space += 1
    elif c.isdigit():
        digit += 1
    else:
        others += 1

print("英文字母:", letters)
print("空格:", space)
print("数字:", digit)
print("其他字符:", others)

img


s = input("请输入一串字符: ")
letters = 0
spaces = 0
digits = 0
others = 0
for c in s:
    if c.isalpha():
        letters += 1
    elif c.isspace():
        spaces += 1
    elif c.isdigit():
        digits += 1
    else:
        others += 1
print("英文字母: %d" % letters)
print("空格: %d" % spaces)
print("数字: %d" % digits)
print("其他字符: %d" % others)