大神求解!!!(┯_┯) 请编写一个程序,统计并输出用户输入的一行文字中,英文字符、数字、空格和其他

大神求解!!!(┯_┯) 请编写一个程序,统计并输出用户输入的一行文字中,英文字符、数字、空格和其他字符的个数分别是多少。(提示:使用字符串的ord()函数。)

eng = num = space = other = 0

string = str(input('Please input a string:'))

for i in string:
    if ord(i)>=ord('A') and ord(i)<=ord('Z') or ord(i)>=ord('a') and ord(i)<=ord('z'):
        eng += 1
    elif ord(i)>=ord('0') and ord(i)<=ord('9'):
        num += 1
    elif ord(i) == 32:
        space += 1
    else:
        other += 1

print('English char:{0}\nNumber char:{1}\nSpace char:{2}\nOther char:{3}'.format(eng, num, space, other))