Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Loops and Lists; Passwords and Quarantine
Overview
This homework is worth 100 points total toward your overall homework grade.
There are two parts in the homework, each to be submitted
separately. All parts should be submitted by the deadline or your program will be considered late.
See the handout for Submission Guidelines and Collaboration Policy for a discussion on grading
and on what is considered excessive collaboration. These rules will be in force for the rest of the
semester.
You will need the utilities and data files we provide in hw4_files.zip, so be sure to download this
file from the Course Materials section of Submitty and unzip it into your directory for HW 4.
Module hw4_util.py is written to help you read information from the files. You do not need to
know how functions provided in hw4_util.py are implemented (but feel free to examine the code,
if you are interested), you can simply use them.
Final note, you will need to use loops in this assignment. We will leave the choice of the loop type
up to you. Please feel free to use while loops or for loops depending on the task and your personal
preference.
Part 1 — Password Strength
Often when you create a password it is judged for its strength. The estimate of strength is compute
by applying several rules — about the length of the password, the presence of certain types of
characters, its match against common passwords, and even its match against license plates. In this
part of the homework you will implement a few simple strength judgment rules and then determine
if a password is to be rejected, or rated poor, fair, good or excellent.
Your program should start by asking for and reading in a password. The program should then
evaluate the password based on the following rules. Each rule contributes to a numerical score
(which starts at 0):
1. Length: If the password is 6 or 7 characters long then add 1 to the score; if it is 8, 9 or 10
characters long then add 2; and longer than 10 add 3.
2. Case: If it contains at least two upper case letters and two lower case letters add 2 to the
score, while if it contains at least one of each, add 1 to the score.
3. Digits: If it contains at least two digits add 2 to the score and if it contains at least one digit
then add 1.
4. Punctuation: If it contains at least one of !@#$ add 1 and if it contains at least one of %^&*
then add 1 (total possible of 2).
5. NY License: If it contains three letters (upper or lower case) followed by four digits, then
it potentially matches a NY state license plate. In this case, subtract 2 from the score.
6. Common Password: If the lower case version of the password exactly matches a password
found in a list of common passwords, then subtract 3 from the score.
Whenever a rule is applied that creates a change in the score, generate an explanatory line of
output. After applying all the rules, output the score and then convert it to a final strength rating
of the password:
Rejected: the score is less than or equal to 0.
Poor: the score is 1 or 2.
Fair: the score is 3 or 4
Good: the score is 5 or 6
Excellent: the score is 7 or above.
Part 1 Notes
1. For this part and for part 2 you should write functions to keep the code clean, clear and easy
to manage.
2. We have provided you with a number of examples that show output values and formatting.
Please follow these examples closely.
3. The common passwords are extracted from a file. One of the utility functions we have provided
reads this file and return a list of these passwords. To use this function, start by making sure
that hw4_util.py and password_list_top_100.txt are in the same folder as your code.