#! python
#STRONG PASSWORD PROGRAM
import re, pyperclip
pw_compare_lower=re.compile(r'[a-z]')
pw_compare_upper=re.compile(r'[A-Z]')
pw_compare_digit=re.compile(r'[0-9]')
gr=str(input())
def Checker(gr):
if len(gr)<8:
return 0
if pw_compare_lower.search(gr)==None:
return 0
if pw_compare_upper.search(gr)==None:
return 0
if pw_compare_digit.search(gr)==None:
return 0
return 1
if (Checker(gr))==1:
print("Strong Password")
elif (Checker(gr))==0:
print("Weak Password")
Is there a way I can write the three pw_compare_digit, pw_compare_upper, pw_compare_lower functions in one line to form a single regex.
The conditions are as below:
A strong password is defined as one that is at least eight characters long, contains both uppercase and lowercase characters, and has at least one digit