Question: write it in python COMP 1012: Lab 5 February 24th to February 28th, 2020 Material covered . Conditional statements while loops Exercises Question 1: Password
write it in python

COMP 1012: Lab 5 February 24th to February 28th, 2020 Material covered . Conditional statements while loops Exercises Question 1: Password checking You are presented with a file passwords.txt where each line contains an email address followed by a password. The email address is separated from the password by a comma. Your job is to write a Python script (starting with the template lab591.py) to flag all passwords that are not secure (or insecure). A password is considered secure if it satisfies the following conditions: contains at least 8 characters, . contains at least one numeric digit, and contains at least alphabet character. Otherwise, a password is not secure. Your Python script that will read in the file passwords.txt and for each insecure password, print the following information: * the line number in the file * the email address * the password * condition(s) password failed to be secure At the end, you should also print the number of email addresses with insecure passwords. For example, suppose the file passwords.txt contain the following lines: Ben. Li@umanitoba.ca, abc123 Joe. Blow@yahoo.com, ay799dkz! John. Wong@gmail.com, mrcool Row.Fernando@hotmail.com, 12345789 Sheikh. Jubair@umanitoba.ca, ntyd888896 Olivia.Li@gmail.com, 8739! Then the output should look like: Invalid Passwords Detail: 1) Ben.Li@umanitoba.ca, abc123: less than 8 characters John. Wong@gmail.com, mrcool:less than 8 characters, no digit 4) Row. Fernando@hotmail.com, 12345789: no alphabet character 6) Olivia. Li@gmail.com, 8739!:less than 8 characters, no alphabet character There were 4 emails with insecure passwords. The file lab591.py contains two functions hasNumbers(s) and hasAlpha(s) which returns True if and only if s has a digit and alphabet character, respectively. no . Dodatna
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
