Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function password.strength () that takes one argument, password, which is a string of characters consisting of lowercase letters, uppercase letters, digits and non-alphanumerical
Write a function password.strength () that takes one argument, password, which is a string of characters consisting of lowercase letters, uppercase letters, digits and non-alphanumerical symbols. The function allocates points to password based on the location of certain characters in the string CSE 101 -Spring 2018 Homework #4 Page 1 Rule the first character is a digit the last character is a digit a digit that is anywhere else the first character is an uppercase letter the last character is an uppercase letter an u a lowercase letter that is anywhere the first character is a symbol the last character is a symbol a symbol that is anywhere else Points to Add 40 50 25 25 15 ase letter that is anywhere else 25 35 15 The function returns the total points allocated by the rules above multiplied by the length of the password. Double counting of points is acceptable in some (not all!) circumstances. For example, consider a string of length 1 that contains an uppercase letter. What is the strength of that string? For example, if password is , Abce%, , the total points allocated by the rules above will be 75' Then, 75 the length of password (5) will give us the return value of 375 total points Note: You may assume that the password is non-empty Examples: Function Call password strength 'f BAcG') password strength ('tlx') password strength ('W63Ut HTuN') password strength ('f' ) password-strength ("Msq08 #2w&GpMm") | 2275 Return Value 360 75 1170 680 1240 | 1870 1540 225 assword strength 'qH jTt 9YQ) password strength'gw74X password-strength ('69@%B9T(12J') password_strength ('y n (q8XxVp2) password strength' !fxus)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started