print'Your password must contain the following.. \n\n - at least 1 uppercase letter\n - at least 1 lowercase letter \n - at least 1 number \n - at least 7 characters' # Tells the user what the password requires
password = 0 #Sets the password at 0 , gives an entry point into the while loop
while password <7: #This while loop, while the password count is less than 7 execute the following
s=raw_input('\nPlease choose a password: ') #Giving the password a variable
errors = [] #?????????????????????
if not any(x.isupper() for x in s): #This is testing if there is NOT any uppercase characters in the string
errors.append('\nERROR Your password needs at least 1 capital letter')
if not any (x.islower() for x in s):
errors.append('\nERROR Your password needs at least 1 lower case letter')
if not any (x.isdigit() for x in s):
errors.append('\nERROR Your password needs at least 1 number')
if len(s)< 7:
print '\nERROR Your password needs to be at least 7 characters'
if errors:
print '\n'.join(errors)
if (any(x.isupper() for x in s) and any(x.islower() for x in s) and any(x.isdigit() for x in s) and len(s) >= 7):
print '\n\nGreat, your all set up and ready to go. \n\nYour login:',login, '\nYour password:',s
password = password +7
问问题
94 次