You are viewing a single comment's thread. Return to all comments →
import re
def is_valid_uid(uid): if len(uid) != 10 or not uid.isalnum(): return False if len(re.findall(r'[A-Z]', uid)) < 2: return False if len(re.findall(r'\d', uid)) < 3: return False if len(set(uid)) != len(uid): return False return True
if name == 'main': n = int(input()) for _ in range(n): uid = input().strip() if is_valid_uid(uid): print("Valid") else: print("Invalid")
Seems like cookies are disabled on this browser, please enable them to open this website
Validating UID
You are viewing a single comment's thread. Return to all comments →
import re
def is_valid_uid(uid): if len(uid) != 10 or not uid.isalnum(): return False if len(re.findall(r'[A-Z]', uid)) < 2: return False if len(re.findall(r'\d', uid)) < 3: return False if len(set(uid)) != len(uid): return False return True
if name == 'main': n = int(input()) for _ in range(n): uid = input().strip() if is_valid_uid(uid): print("Valid") else: print("Invalid")