You are viewing a single comment's thread. Return to all comments →
Is this case optimal?
has_alphanumeric, has_alphabetical, has_digits, has_lowercase, has_uppercase = False, False, False, False, False for char in input().strip(): if not has_alphanumeric and char.isalnum(): has_alphanumeric = True if not has_alphabetical and char.isalpha(): has_alphabetical = True if not has_digits and char.isdigit(): has_digits = True if not has_lowercase and char.islower(): has_lowercase = True if not has_uppercase and char.isupper(): has_uppercase = True if all((has_alphanumeric, has_alphabetical, has_digits, has_lowercase, has_uppercase)): break print(f'{has_alphanumeric}\n{has_alphabetical}\n{has_digits}\n{has_lowercase}\n{has_uppercase}')
Seems like cookies are disabled on this browser, please enable them to open this website
String Validators
You are viewing a single comment's thread. Return to all comments →
Is this case optimal?