• + 0 comments
    import re
    for _ in range(int(input())):
        inp=input()
        isvalid="Invalid"
        if (re.fullmatch(r'[0-9a-zA-z]{10}',inp) 
        and len(set(inp))==10 
        and sum('0'<=c<='9' for c in inp)>2 
        and sum('A'<=c<='Z' for c in inp)>1):
                isvalid="Valid"
        print(isvalid)
    

    why not isdigit() or isalnum()? They allow unicode characters (decimal digits in other language locales) and superscripts. our goal for digits is to only have [0-9]