import re
def IsStrongPW(passwd):
flag =True
if len(passwd) < 8:
print('Length is too short.')
flag = False
Num = re.compile(r'.*\d.*')
if Num.search(passwd) == None:
print("NO numbers")
flag = False
capi = re.compile(r'.*[A-Z].*')
if capi.search(passwd) == None:
print("NO capitals")
flag = False
lows = re.compile(r'.*[a-z].*')
if lows.search(passwd) == None:
print("NO lowcase")
flag = False
return flag
while 1:
print('please input your PW:')
password = input()
if IsStrongPW(password):
print('password is a strong password')
else:
print('password is weak,please change one')