Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

InfoTc 1040 Introduction to Problem Solving and Programming Password Checker - P

ID: 3681287 • Letter: I

Question

InfoTc 1040 Introduction to Problem Solving and Programming Password Checker - Python 3.5

To keep a user account safe, it’s important to have a strong password. In this assignment, you’ll write a program that checks a user’s password and indicates how strong it is.

Requirements:

We’ll evaluate password strength based on the following criteria:

A password should contain…

1. upper-case letters

2. lower-case letters

3. numbers

4. symbols (any keyboard character that is not a letter or number)

5. and it should not contain personal information or common words If a password meets…

• all 5 criteria, it should be rated as “very strong”

• 4 criteria, “strong”

• 3 criteria, “moderate”

• 2 criteria, “weak”

• any less, “very weak” Passwords that are less than 8 characters long should not be accepted.

To check whether or not a password meets criteria #5, we should start the program by asking the user for their first and last names. Their password should not contain either name. The reason for that is that hackers often try to guess passwords by using personal information. A password that contains personal info is easier to guess. Likewise, there are many common words and phrases that people like to use in their passwords. We’ll say that a password fails criteria #5 if it contains any of these strings:

• password • 12345 • qwerty • letmein • dragon • baseball • football • starwars

The program should ask for and test a user’s password. It should then display the strength of the password and ask the user if they’d like to test another password. The next section contains sample output.

InfoTc 1040 Introduction to Problem Solving and Programming Password Checker Sample Output

Welcome to the password strength checker!

What is your first name? Sally

What is your last name? Smith

Please enter a password to check: air

Your password is too short. It must be at least 8 characters long.

Please enter a password to check: airplane

Your password is rated as: weak

(2) Would you like to test another password (y/n)? y

Please enter a password to check: AirPlane

Your password is rated as: moderate

(3) Would you like to test another password (y/n)? y

Please enter a password to check: AirPlan3

Your password is rated as: strong

(4) Would you like to test another password (y/n)? y

Please enter a password to check: @irPlan3

Your password is rated as: very strong

(5) Would you like to test another password (y/n)? y

Please enter a password to check: baseball

Your password is rated as: very weak

(1) Would you like to test another password (y/n)? y

Please enter a password to check: SallySmith

Your password is rated as: weak

(2) Would you like to test another password (y/n)? n

Explanation / Answer

print("Welcome to the password strength checker!")
fname = input ("What is your first name?");
lname = input ("What is your last name?");

wordslist = ["password", "12345", "qwerty","letmein","dragon","baseball","football","starwars"]
while(1):
   passwd = input ("Please enter a password to check: ")
   #validate password
   length = len(passwd)
   validity = 0
   if(length < 8):
       print("Your password is too short. It must be at least 8 characters long.")
   else:
       if (any(x.isupper() for x in passwd)):
           validity = validity+1
       if (any(x.islower() for x in passwd)):
           validity = validity+1
       if (any(x.isdigit() for x in passwd)):
           validity = validity+1  
          
       for x in passwd:
           if(not x.isupper() and not x.islower() and not x.isdigit()):
               validity = validity+1  
               break
      
       if(not (passwd != fname or passwd != lname or passwd not in wordslist)):
           validity = validity +1
       if(validity == 5):
           print("Very Strong")
       if(validity == 4):
           print("Strong")
       if(validity == 3):
           print("Moderate")
       if(validity == 2):
           print("Weak")  
       if(validity < 2):
           print("Very Weak")  
      
   cont = input("Would you like to test another password (y/n)?")
   if(cont != 'y'):
       break
   

--output------------

Welcome to the password strength checker!
What is your first name?smith
What is your last name?Howard
Please enter a password to check: pass
Your password is too short. It must be at least 8 characters long.
Would you like to test another password (y/n)?y
Please enter a password to check: Passsssss
Weak
Would you like to test another password (y/n)?y
Please enter a password to check: Passs@89999
Strong