preamble
Password is a very private thing it has been associated with a series of confidential things, the password in World War II played a big role. In our life, especially now on our cell phones there are many apps is indispensable to our life, in the login account we are indispensable to enter the password of this link, although there are many apps available through SMS verification or other ways to log in, but the password can be other people to log in to your account is an important way, the harder the password the more the account will not be stolen. It is important to have a password with a high difficulty factor.
Description of the problem
We know that passwords are one of the most important and essential things we have nowadays. Most of the passwords are created with a reminder of the difficulty level that must be reached before they can be used. We know that a password can be composed of a lengthy string of numeric symbols, upper or lower case letters, and the presence of these elements determines the difficulty level of the password, and when the length reaches a certain level, the difficulty level will be increased.
Example:
Input: 5201314cS.
Output: password level 5
prescription
To solve this problem we just need to determine if there are numbers, symbols, lowercase letters, uppercase letters, and the length of the password is long enough to get a password level.
List of Codes Know Your Password Difficulty Level Codes
def level(): def number(password): # Judging the numbers number = False for c in password: if (): number = True break return number def islower(password): # Lowercase islower = False for c in password: if (): islower = True break return islower def isupper(password): # Capitalization isupper = False for c in password: if (): isupper = True break return isupper def string(password): # punctuation str=(',.:;*@$%^&!') string = False for c in password: if c in str: string = True break return string password = input('Please enter the password:') # Password strength, initialized to 0 strength_level = 0 a=len(password)//6 strength_level += a if number(password): strength_level += 1 if islower(password): strength_level += 1 if isupper(password): strength_level += 1 if str(password): strength_level += 1 print("Your password strength is{}".format(strength_level)) print(level())
concluding remarks
The question is simple but relates to the security of everyone's important stuff, and passwords shouldn't be set in stone, don't you have to go and change your own password can make the account more secure.
The problem is solved but I feel that the code could be simpler and I don't know how to change it.
To this article on the use of Python to determine the difficulty level of your password is introduced to this article, more related Python password difficulty level content please search for my previous articles or continue to browse the following related articles I hope you will support me in the future!