Strong password
Problem to check given password is strong or not.
- The password length must be equal or above 8.
- The password character must contains number,special character and alphabets.
Example-1:
Input : s = "AZ#[email protected]" Output : Strong password
Example-2:
Input : s = "fun1234" Output : Not a Strong password
Solution
s = "AZ#[email protected]" n = 0 a = 0 sc = 0 sp = 0 for i in range(len(s)): if(s[i].isdigit()): n = 1 elif(s[i].isalpha()): a = 1 elif(s[i]==" "): sp = 1 elif(not(s[i].isalnum())): sc = 1 if(sp==1): print("Not a Strong password") elif(n==1 and a==1 and sc==1 and len(s)>=8): print("Strong password") elif(len(s)<8): print("Not a Strong password")
Output
Strong password