Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Write Program Asks User Enter Password Checks Different Requirements Approving Secure Repe Q35579188

Write a program that asks the user to enter a password, and thenchecks it for a few different requirements before approving it assecure and repeating the final password to the user.

The program must re-prompt the user until they provide apassword that satisfies all of the conditions. It must also tellthe user each of the conditions they failed, and how to fixit.
If there is more than one thing wrong (e.g., no lowercase, andlonger than 15 characters), the program must print out all of thethings that are wrong, and how to fix them.

The program follows these rules for passwords:

  1. The password must contain at least one lowercase letter.

  2. The password must contain at least one uppercase letter.

  3. The password must be between 6 and 20 characters, inclusive.

    a. If the password is between 6 and 13 characters, inclusive, itmust contain a “7” somewhere in the password.

    b. If the password is between 14 and 20 characters, inclusive,itmust contain a “2” somewhere in the password.

  4. The password cannot contain the characters “0” and “O” (zeroanduppercase o) at the same time. (It can contain a “0” or an “O”,just notboth at the same time. It may also contain neither.)

For this part of the homework, you must have an in-line commentat the top of each of your program’s individual if, elif, and elsestatements, explaining what is being checked by thatconditional.

(HINT: Think carefully about what your conditionals should looklike. If necessary, draw a truth table to help figure out whatdifferent inputs will do. Using a Boolean flag will also likelymake this easier.)

(See the next page for sample output.)

Here is some sample output for hw4_part3.py, with the user inputin blue. (Yours does not have to match this word for word, but itshould be similar.)

linux1[8]% python hw4_part3.pyPlease enter a password: dogsPassword must have an uppercase characterPassword must be at least 6 charactersPlease enter a password: DOGSPassword must have a lowercase characterPassword must be at least 6 charactersPlease enter a password: DogsPassword must be at least 6 charactersPlease enter a password: DoggosShorter passwords must contain a 7Please enter a password: 7DoggosThank you for picking the secure password 7Doggos

linux1[9]% python hw4_part3.py
Please enter a password: thisMustBeSecureItsLongAlso27Password mustbe no longer than 20 characters
Please enter a password: abcdefghijklmnopqrst
Password must have an uppercase character
Longer passwords must contain a 2
Please enter a password: 2and7EQUALSnine
Thank you for picking the secure password 2and7EQUALSnine

linux1[10]% python hw4_part3.pyPlease enter a password: O_and_0Shorter passwords must contain a 7Password cannot contain a O and a 0 at the same timePlease enter a password: O_and_7Thank you for picking the secure password O_and_7

linux1[11]% python hw4_part3.py
Please enter a password: greatPassword7!
Longer passwords must contain a 2
Please enter a password: greatPassword2!
Thank you for picking the secure password greatPassword2!

Leave a Reply

Your email address will not be published. Required fields are marked *