Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def pass_validation(any_password):
- counter_digit = 0
- if 6 <= len(any_password) <= 10:
- len_check = True
- else:
- len_check = False
- print(f"Password must be between 6 and 10 characters")
- if not any_password.isalnum():
- print("Password must consist only of letters and digits")
- for char in any_password:
- if char.isdigit():
- counter_digit += 1
- if counter_digit >= 2:
- digit_check = True
- else:
- digit_check = False
- print(f"Password must have at least 2 digits")
- return len_check, any_password.isalnum(), digit_check
- password = input()
- if all(pass_validation(password)):
- print(f"Password is valid")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement