Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write it in python, and using dictionaries to separate the key and value *********! please COMP 1012: Lab 5 February 24th to February 28th, 2020

write it in python, and using dictionaries to separate the key and value *********! please

image text in transcribed

image text in transcribed

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 passwords - 2$ $#(F) (E) PETO) (V) (H) 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions