#test 1 solution def validPlate(my_str): l_str = len(my_str) upper=False lower=False count_digit = 0 other=False if(l_str!=7): return False for i in range(l_str): if(my_str[i].islower()): lower = True elif(my_str[i].isupper()): upper = True elif(my_str[i].isdigit()): count_digit+=1 else: other=True if(lower or other): return False last=my_str[l_str-1] first=my_str[0] if(upper): if(count_digit==6 and (last.isupper() or first=='I')): return False elif(count_digit==5 and last=='I' and first=='I'): return False else: return True def main(): my_str=input("enter string ") if(validPlate(my_str)): print("Valid") else: print("NOT VALID") main()