0
Code Coach Password Validator
My code for the code coach password validator fails test case 7 and I can’t figure out why. Can anyone help me? https://code.sololearn.com/c29wGB6fpBRh/?ref=app
2 ответов
+ 1
This may help you,
password=input()
scount=0
numcount=0
spec=['!', '@', '#', '#x27;, '%', '&', '*']
num='0123456789'
strength=""
for char in password:
for c in password:
if char in spec:
scount+=1
if char in num:
numcount+=1
if scount>1 and numcount>1 and len(password)>7:
strength="Strong"
else:
strength="Weak"
print(strength)
+ 1
import re
password= input()
x = True
while x:
if (len(password)<7 or len(password)>999):
break
elif not re.search("[a-z]",password):
break
elif not re.search("[0-9]",password):
break
elif not re.search("[!@#$%&*]",password):
break
else:
print("Strong")
x=False
break
if x:
print("Weak")