In this HackerRank Validating, UID problem solution ABCXYZ company has up to 100 employees. The company decides to create a unique identification number (UID) for each of its employees. The company has assigned you the task of validating all the randomly generated UIDs.

HackerRank Validating UID in python problem solution

HackerRank Validating UID in python problem solution

import re

tests = int(raw_input())

for test in xrange(tests):
    s = raw_input()
    b = True
    up, di = 0, 0
    curr = set()
    if (len(s) != 10):
        b = False

    for c in s:
        if (c in curr):
            b = False
        curr.add(c)
        if (not c.isalnum()):
            b = False
        elif (c.isupper()):
            up += 1
        elif (c.isdigit()):
            di += 1
    if (b and (up >= 2) and (di >= 3)):
        print "Valid"
    else:
        print "Invalid"