Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def solve():
- password = input()
- digits = 0
- output = ''
- if len(password) < 6 or len(password) > 10:
- output += "Password must be between 6 and 10 characters\n"
- for i in password:
- if 64 < ord(i) < 91 or 96 < ord(i) < 123 or 47 < ord(i) < 58:
- if 47 < ord(i) < 58:
- digits += 1
- else:
- if not "Password must consist only of letters and digits" in output:
- output += "Password must consist only of letters and digits\n"
- break
- if digits < 2:
- output += "Password must have at least 2 digits"
- if output == '':
- output = "Password is valid"
- return output
- print(solve())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement