+ 6
What's wrong with this password validation task4 problem?
user = input() store = ['!', '@', '#', '
#x27;, '%', '&', '*'] sp = '' di = '' st = '' tot = 0 for i in user: if i in store: sp += i elif i.isdigit(): di += i elif i.isalnum(): st += i else: tot += 1 if len(sp) >= 2 and len(di) >= 2: print('Strong') else: print('Weak')4 Réponses
+ 6
The password must be at least 7 characters long. That is what you do not implemented yet.
+ 5
Find out why your code is failing for input case :
12@@
edit: take length constraint into count
+ 5
if len(sp) >= 2 and len(di) >= 2 and len(user) > 7:
+ 5
yonas ,
shouldn't it be like that:
...
if len(sp) >= 2 and len(di) >= 2 and len(user) >= 7:
...
you also check with isalnum(), but this is never used. btw, this checks for alphabetical characters and also for digits. to check for only alphabetical characters we can use isalpha()