Oct-17-2016, 09:14 PM
(Oct-12-2016, 03:49 AM)Mekire Wrote: Neah, let's get sadistic:
def check(password): test = (str.isdigit, str.isupper, str.islower) good_enough = all(any(f(p) for p in password) for f in test) return len(password) >= 8 and good_enoughNote: if you try to turn the above into a professor and you don't know basic python they will get very suspicious.
Why not make the length one of the tests?
def check(password): test = (str.isdigit, str.isupper, str.islower, lambda x: len(x)>=8) return all(any(f(p) for p in password) for f in test)