+ 10
How to research two special characters in password using python?
For one time I can search a special character like this: elif not re.search("[@$!#%&*]", password): flag = -1 break
2 Respuestas
+ 2
Sym =['!', '@', '#', '#x27;, '%', '&', '*']
userStr = input()
for char in userStr:
if char in Sym:
numbSym+=1
Full code:
chars =['!', '@', '#', '#x27;, '%', '&', '*']
userStr = input()
numbChar=0
numbLett=0
numbInt=0
#get the requirements
for char in userStr:
if char in chars:
numbChar+=1
elif char.isdigit():
numbInt+=1
elif char.isalpha():
numbLett+=1
#check the requirements
if numbChar >=2 and numbInt >= 2 and len(userStr) >= 7:
print("Strong")
else:
print("Weak")
+ 1
Wali Khan Eisakhil
spe = "@$!#&*"
specount = 0
for i in spe:
if i in pw:
specount += 1