Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Created on Jan 11, 2017
- @author: tkelly
- '''
- #! python3
- # strongPasswordDetection.py - a program to verify that a password is strong
- # a strong password has: >8 characters, upper & lower case, and >1 digit
- import re
- pw = input("Please enter a password at least 8 characters long, containing at least 1 uppercase and 1 lowercase letter and at least 1 digit")
- capsReg = re.compile(r"[A-Z]")
- lowersReg = re.compile(r"[a-z]")
- digitsReg = re.compile(r"\d")
- def strongPassword(password):
- if len(password) <8:
- print("Your password needs to be at least 8 characters long. Please try again")
- else:
- if capsReg.search(password) and lowersReg.search(password) and digitsReg.search(password):
- return True
- else:
- return False
- print(strongPassword(pw))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement