+ 2
Have anyone made a better password validator
I just tried out my first program. And this is what a got. It's pretty simple. Consists of two parts: password length validation and symbols validation. For example this password can be accepted: Mypasword123 But this one can't be used: 😂😭😉🤣😊 https://code.sololearn.com/cXD0E9Gdbxx9/?ref=app
5 odpowiedzi
+ 2
Try this too:
import re
usinput = input("Type in your password: \n")
check = re.match(r"(?=.*?[^a-zA-Z0-9])(?=.*?[A-Z])(?=.*?[0-9]).{8,}", usinput)
print(usinput)
if check:
print("strong")
else:
print("weak")
+ 3
David Ashton thanks a lot. I will use your code as the example in my future projects
+ 2
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")
+ 1
Thống Nguyễn thanks man