怎么用isdigit()函数编写这个程序啊

编写程序,验证使用input()函数输入的字符串符合我校学生学号的规则。规则是:(1)共8个字符;(2)首位必须是英文大写字符;(3)后7位是数字。若通过验证输出提示语“输入的学号是:H1234567,通过验证。”(注:“H1234567”为输入的学号);否则输出提示语“输入的学号有误,重新输入。”,并返回强制重新输入,直到输入正确的格式通过验证



while True:
    s = input()
    if len(s) == 8 and s[0].isupper() and s[1].isdigit() and s[2].isdigit() and s[3].isdigit() and s[4].isdigit() and s[5].isdigit() and s[6].isdigit() and s[7].isdigit():
        break
    print("输入的学号有误,重新输入")
print("输入的学号是:{},通过验证".format(s))


while True:    
    s = input(">>>")
    
    flag = True
    if len(s) != 8:flag =False
    if s[0] < 'A' or s[0] > 'Z': flag = False
    if not s[1:].isdigit(): flag = False
    if not flag :
        print("输入的学号有误,重新输入。")
    else:
        print("通过!")
        break

while True:
    a = input()
    if len(a) == 8:
        for i in range(len(a)):
            if i == 0:
                if a[i].isupper():
                    continue
                else:
                    print("输入的学号有误,重新输入。")
                    break
            else:
                if a[i].isdigit():
                    continue
                else:
                    print("输入的学号有误,重新输入。")
                    break
        else:
            print("输入的学号是:%s,通过验证。" % (a))
            break
    else:
        print("输入的学号有误,重新输入。")

img