Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Answer to http://dpaste.com/37ZVD3M
- import string
- def validate(password):
- """
- Its a general password validation question
- - one uppercase
- - one lowecase
- - special charater .,/
- - posivitve integer
- """
- # Minimum one uppercase
- if not any(c.isupper() for c in password):
- return False
- # Minimum one lowercase
- if not any(c.islower() for c in password):
- return False
- # . or , or / are required
- if not any(c in ".,/" for c in password):
- return False
- # Minimum one digit in password
- if not any(c in string.digits for c in password):
- return False
- # No negative integers in str
- if any(
- last == "-" and current.isdigit()
- for (last, current)
- in zip(*[iter(password)] * 2)
- ):
- return False
- return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement