Password validation
I tried to solve this.. I got all the 9 conditions correct but the last 4 were wrong. Somebody help me!! p=input("") #string input count=0 special=['!', '@', '#', '$', '%', '&', '*'] a=0 d=0 sl=0 for i in range(len(p)): if(p[i].isalpha()): a=a+1 elif(p[i].isdigit()): d=d+1 elif (p[i] in special): sl=sl+1; count=a+d+sl if(count>=11 and sl>=2 and d>=2 and a>=7): print("Strong") else: print("Weak") This is my code in python.☝️☝️ And the below one is in C 👇👇. include <stdlib.h> #include <stdio.h> #include <string.h> main() { char l[1000]; int i,v,a=0,d=0,s=0,count=0; //printf("\n enter passeord:"); gets (l); for(i=0;i<strlen(l);i++) { if(l[i]=='!'|| l[i]=='@'|| l[i]=='#'||l[i]=='$'|| l[i]=='%'|| l[i]=='&' ||l[i]=='*') s++; else if((l[i]>='A'&&l[i]<='Z')|| (l[i]>='a'&&l[i]<='z')) a++; else if(isdigit(l[i])) d++; } if(d>=2 && s>=2 && a>=7) printf("Strong"); else printf("Weak"); return 0; }