Please note that Exercise 3 requires that you create 2 programs: my_password_module . use_my_password_module my_password_module...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Please note that Exercise 3 requires that you create 2 programs: • my_password_module . use_my_password_module my_password_module is a container for password vandation functions that will be used by other programs. The module should contain the following validation function: • validate_password() The code in validate_password() should include all code demonstrated in the Part 3 tutorial video plus additional code that implements the following requirements: 1 Password may not contain the word "password" in any case. 2 Password may not contain the word "secret" in any case Please be sure to code all strings used as regular expression patterns using Python raw strings. my_password_module should also include a main() function that will contain unit testing code. Your code should include all unit test code demonstrated in the Part 3 tutorial video plus enough additional unit test cases to fully test the additional requirements introduced above. Since your version of my password module is an enhancement of the code demonstrated in the Part 3 tutorial video, you should use the unit testing code from that video as your starting point. When you add further unit testing code, use my approach from the tutorial video as your model. When this module is run by itself (not when it is imported), the console session should look like this: Unit testing output... D Test case 1: password too short When this module is run by itself (not when it is imported), the console session should look like this: Unit testing output... Test case 1: password too short passed Test case 2: password meets all criteri passed Test case 3: password missing upper case letter passed Test case 4: password missing lower-case letter passed Test case 5: password missing special character passed Test case 6: password missing multiple of the criteria passed Test case 7: password contains word password passed Test case 8: password contains word secret pageed Page 5 of 8 def validate_password (candidate): error_messages = [] # returning empty List indicates password is valid if len(candidate) < 6: error_messages.append('Password must be at least 6 characters long.') if not re.search(r' [A-Z]', candidate): error_messages.append('Password must include at least one upper-case letter (A-Z).') if not re.search(r' [a-z]', candidate): error_messages.append('Password must include at least one lower-case letter (a-z).') if not re.search(r' [!@#$%^&*]', candidate): error_messages.append('Password must include at least one lower-case letter (!@#$%^&*).') return error_messages def main(): print('Unit testing output...') main() if actual_result == expected_re... Please note that Exercise 3 requires that you create 2 programs: • my_password_module . use_my_password_module my_password_module is a container for password vandation functions that will be used by other programs. The module should contain the following validation function: • validate_password() The code in validate_password() should include all code demonstrated in the Part 3 tutorial video plus additional code that implements the following requirements: 1 Password may not contain the word "password" in any case. 2 Password may not contain the word "secret" in any case Please be sure to code all strings used as regular expression patterns using Python raw strings. my_password_module should also include a main() function that will contain unit testing code. Your code should include all unit test code demonstrated in the Part 3 tutorial video plus enough additional unit test cases to fully test the additional requirements introduced above. Since your version of my password module is an enhancement of the code demonstrated in the Part 3 tutorial video, you should use the unit testing code from that video as your starting point. When you add further unit testing code, use my approach from the tutorial video as your model. When this module is run by itself (not when it is imported), the console session should look like this: Unit testing output... D Test case 1: password too short When this module is run by itself (not when it is imported), the console session should look like this: Unit testing output... Test case 1: password too short passed Test case 2: password meets all criteri passed Test case 3: password missing upper case letter passed Test case 4: password missing lower-case letter passed Test case 5: password missing special character passed Test case 6: password missing multiple of the criteria passed Test case 7: password contains word password passed Test case 8: password contains word secret pageed Page 5 of 8 def validate_password (candidate): error_messages = [] # returning empty List indicates password is valid if len(candidate) < 6: error_messages.append('Password must be at least 6 characters long.') if not re.search(r' [A-Z]', candidate): error_messages.append('Password must include at least one upper-case letter (A-Z).') if not re.search(r' [a-z]', candidate): error_messages.append('Password must include at least one lower-case letter (a-z).') if not re.search(r' [!@#$%^&*]', candidate): error_messages.append('Password must include at least one lower-case letter (!@#$%^&*).') return error_messages def main(): print('Unit testing output...') main() if actual_result == expected_re...
Expert Answer:
Answer rating: 100% (QA)
code for mypasswordmodule python import re def validatepasswordcandidate Validates a password Args candidate The password to validate Returns A list o... View the full answer
Related Book For
Posted Date:
Students also viewed these accounting questions
-
The accounts that will be used by Zant Moving Company follow. Prepare a chart of accounts for the firm. Classify the accounts by type, arrange them in an appropriate order, and assign suitable...
-
The accounts that will be used by Dad & Sons Moving Company follow. Prepare a chart of accounts for the firm. Classify the accounts by type, arrange them in an appropriate order, and assign suitable...
-
The accounts that will be used by Three Brothers Moving Company follow. Prepare a chart of accounts for the firm. Classify the accounts by type, arrange them in an appropriate order, and assign...
-
1. Identify the function of the underlined noun/s in each item. 1. On rainy mornings, is your bus usually late? 2. On the desk were the red pencils. 3. Volcanoes and earthquakes are destructive...
-
Humphrey and Lauren must share 10 pounds of food and 8 gallons of water. Humphrey's utility function is Which implies Lauren's utility function is MU
-
Describe how a company chooses a frame of reference.
-
Derive Equation 5.35. 1 = Efiff +Emim1vm Ef1 Vf+ Em1Vm (5.35)
-
Darnell Poston, owner of Poston Manufacturing, Inc., wants to determine the cost behavior of labor and overhead. Darnell pays his workers a salary; during busy times, everyone works to get the orders...
-
Henry Inc. purchased $10,000 of Container Corporation's 5% bonds at par. The purchase was made on January 1, and the investment was classified as a trading security. On June 30, Henry Inc. received...
-
The Alfredo Fragrance Company produces only one product, a perfume called Hint of Elegance. Hint of Elegance consists of two secret ingredients blended into an exclusive fragrance, which is marketed...
-
5 workers are each paid a fixed salary for working a 180-hour month. Each unit requires 2 hours of labour. Sales for March are forecast at 1,200 units, and no inventory of goods can be held as the...
-
? ??? Romberg integration for approximating f(x) dx gives R1 = 8 and R22 = -1 then f(2)= O 6.5 O 5.5 O -4.75 O-9.5
-
2.3 Implement the logic circuit for the expression F(A B C D) = A B C D + AB CD +(AC) (AB). Please note: Do not simplify the expression. Implement the following function with NAND gates F(A,B, C) = ...
-
Discuss the role of banks in a documentary collection process for the subject: International Trade Finance.
-
Do it task on the topic how to stop terrorism financing give introduction and why select this topic? also choose the industry or company related to this topic give introduction and why choose this...
-
Due to poor spending habits, Robert has accumulated $10,000 in credit card debt. He has missed several payments and now the annual interest rate on the card is 18.95 percent! If he pays $175 per...
-
10. Consider a 3-year installment loan. The APR is 9%. Monthly loan payments are $640. In the 11th month, the beginning balance is $19,000. How much of the $640 payment that month would reduce the...
-
Show that the block upper triangular matrix A in Example 5 is invertible if and only if both A 11 and A 22 are invertible. Data from in Example 5 EXAMPLE 5 A matrix of the form A = [ A11 A12 0 A22 is...
-
Given the coordinates of three points (x1,y1), (x2,y2) , and (x3,y3) it is possible to find the coordinates of the center of the circle (Cx, Cy) that passes through the three points by solving the...
-
For the function y = (x + 25)3/x2, calculate the value of y for the following values of x using element-by-element operations: 1, 2, 3, 4, 5, 6.
-
The boiling temperature of water TB at various altitudes his given in the following table. Determine a linear equation in the form TB = mh + b that best fits the data. Use the equation for...
-
Assume a gain margin of 20 dB and a plant with a nominal gain of 50/sec. Assume also that the minimum GM of the system is specified to 10 dB. To what maximum value of gain can the plant climb under...
-
Name three benefits of using software R/D conversion compared with hardware R/D converters.
-
Correcting for reversal error correction and deadband compensation are special cases of what general technique?
Study smarter with the SolutionInn App