Sankarshan Dahiya Student - Tracking Task 4 - Password Checker and Generator
Sankarshan Dahiya Student - Tracking Task 4 - Password Checker and Generator
A program needs to be created that allows the user to check the strength of
passwords and to generate strong passwords.
The program should check the strength of a password based on a point-scoring
system. When a password is entered, points are awarded based on the length of the
password and the types of characters contained within the password. Points are
deducted if characters are used in a limited way.
The program should also be able to generate a password that, when checked for
strength, is classified as a strong password.
Task 1
A menu is displayed allowing the user to select from the following options:
● Check Password
● Generate Password
● Quit.
Task 1 Code
Menu = int(input("1-Check_Password, 2-Generate_Password,
Anything_else_to_quit: "))
if Menu == 1:
Password1 = input("Ok, Checking Password...")
if Menu == 2:
Password2 = input("Ok, Generating Password...")
if Menu != 1 and Menu != 2:
print("Ok, Quitting Program")
Task 1 Output
Task 2
If the user selects the 'Check Password' option:
● they are asked to enter a password
● if the length of the entered password is less than 8 characters or greater than
24 characters then an appropriate error message is displayed and the user
returned to the menu
● the program checks that the password entered only contains allowed
characters.
● The allowed characters are:
i. upper case letters (A to Z)
ii. lower case letters (a to z)
iii. digits (0 to 9)
iv. allowed symbols (see Figure 1).
● If the password contains a character that is not allowed then an appropriate
error message is displayed and the user returned to the menu.
Task 2 Code
Task 2 Output
Task 3
A point score is calculated for the entered password. The score is set to the length of
the password. For example, if the password is 12 characters in length then the score
is set to 12.
Task 3 Output
Task 4
The point score is then used to determine if the password strength is weak, medium
or strong. If the point score is over 20 then the password is strong. If the point score
is zero or less then the password is weak. The password strength and the point
score should be displayed to the user. The user should then be returned to the
menu.
Task 4 Code
Task 4 Output
Task 5
If the user selects the 'Generate Password' option:
A. the program generates a random number between 8 and 12 inclusive. This
number will be the length of the password
B. the program then generates a random sequence of characters using letters,
digits and/or allowed symbols to create a password of the length set in A
C. the point score for the password is then calculated (in the same way as for a
user-entered password)
D. parts A to C should be repeated until the password strength is strong
E. the generated password and point score should then be displayed and the
user returned to the menu.
Task 5 Code
Task 5 Output
Task 6
If the user selects the 'Quit' option then a suitable message should be displayed and
the program ends.
Task 6 Code
Task 6 Output
The following examples show how the 'Check Password' option should work.