@@ -9,7 +9,7 @@ def passwordValidator():
99 print ('\n Your password should: ' )
1010 print ('\t - Have a minimum length of 6;' )
1111 print ('\t - Have a maximum length of 12;' )
12- print ('\t - Contain at least an uppercase letter or a lowercase letter' )
12+ print ('\t - Contain at least an uppercase letter and a lowercase letter; ' )
1313 print ('\t - Contain at least a number;' )
1414 print ('\t - Contain at least a special character (such as @,+,£,$,%,*^,etc);' )
1515 print ('\t - Not contain space(s).' )
@@ -24,9 +24,13 @@ def passwordValidator():
2424 if ' ' in userPassword :
2525 message = 'Invalid Password..your password shouldn\' t contain space(s)'
2626 return message
27- if not any (i in string .ascii_letters for i in userPassword ):
27+ if not any (i in string .ascii_letters . upper () for i in userPassword ):
2828 message = 'Invalid Password..your password should contain at least '
29- message += 'an uppercase letter and a lowercase letter'
29+ message += 'an uppercase letter'
30+ return message
31+ if not any (i in string .ascii_letters .lower () for i in userPassword ):
32+ message = 'Invalid Password..your password should contain at least '
33+ message += 'a lowercase letter'
3034 return message
3135 if not any (i in string .digits for i in userPassword ):
3236 message = 'Invalid Password..your password should contain at least a number'
@@ -38,4 +42,4 @@ def passwordValidator():
3842 return 'Valid Password!'
3943
4044my_password = passwordValidator ()
41- print (my_password )
45+ print (my_password )
0 commit comments