I need to write a code for an assignment that will take user input of a password (as a string) and lets the user know what elements of the input make the password weak.
The requirements are that the password needs to be at least 8 characters in length, include both upper and lower case letters, and include numbers. My code doesn't need to determine if the password is strong, just why it is weak if it is weak.
so far the code I have written is as follows:
size = len(password)
if size < 8:
print('not long enough')
if password.isalnum():
pass
else:
for x in password:
if x.isupper():
pass
else:
print('no upper case')
for y in password:
if y.islower():
pass
else:
print('no lower case')
return
I made some changes and used the .isalnum operator after my test run returned multiple lines of 'no upper case' and 'no lower case'.
I would greatly appreciate if anyone could nudge me in the right direction as this has confused me for a bit now