This is my 1st project in which I have created a password strength checker
import re
def check_password_strength(password):
if len(password)< 8:
return "Weak: Password must have atleast 8 digit "
if not any(char.isdigit() for char in password):
return "Weak: password must have digit."
if not any(char.isupper() for char in password):
return "Weak: password must contain an uppercase."
if not any(char.islower() for char in password):
return "Weak: password must contain a lowercase."
if not re.search(r"[!@#$%^&*(){}[]<>.?/]", password):
return "Medium: password must contain special character."
return "Strong: your password is strong."
def password_checker():
print("Welcome! to the password strength checker.")
while True:
password = input("Enter your password(or type 'exit' to quit): ")
if password.lower()== 'exit':
print("Thank you for using this tool.")
break
result= check_password_strength(password)
print(result)
if name == "main":
password_checker()