Counting Tuples:
Count the number of passwords of length 3 that begin with a letter of the alphabet and consist of one lowercase letter, one uppercase letter, and one decimal digit
def countingTuples(t): count = 0 for x in t: if(len(x) == 3): hasLower = False hasUpper = False hasDigit = False for y in x: if y.islower(): hasLower = True if y.isupper(): hasUpper = True if y.isdigit(): hasDigit = True if hasLower and hasUpper and hasDigit: count += 1 return count # Testing print(countingTuples(("qweweq","sA3","qwqee2131","As3","3dF","qwe122wA")))
3
Get Answers For Free
Most questions answered within 1 hours.