create our own version of that meter. Complete the function password aracters consisting of lowercase letters, uppercase letters, digits and word based on the location of certain characters in the string. The tot mber that you can use int() to convert a digit character into actual Points to Add ftmost character is one of the symbols !, e, #, or $ +40 ftmost character is a digit +30 en digit anywhere but the leftmost position Id digit anywhere but the leftmost position +20 for each such digit +25 for each such digit ercase letter anywhere +5 for each such lowercase letter +15 (in addition to the +5 from the st character is a lowercase letter ples:

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 8PE: Write a program that reads in a line consisting of a students name, Social Security number, user ID,...
icon
Related questions
Question
Have you ever had the experience, while creating an account on a website, that a little meter pops up to tell you how "strong" your password is?
Let's create our own version of that meter. Complete the 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 the
password based on the location of certain characters in the string. The total at the end is a "score" that measures how strong the password is.
Remember that you can use int() to convert a digit character into actual integer value.
Points to Add
+40
+30
+20 for each such digit
+25 for each such digit
+5 for each such lowercase letter
+15 (in addition to the +5 from the previous rule)
Rule
the leftmost character is one of the symbols !, e, #, or $
the leftmost character is a digit
an even digit anywhere but the leftmost position
an odd digit anywhere but the leftmost position
a lowercase letter anywhere
the last character is a lowercase letter
Examples:
Function Call
password_strength('! Foo')
password_strength('@#Okayz ' )
password_strength('bGWp')
password_strength ( 'PPPPPP121k')
password_strength('!123321strongpassword')
password_strength('9hehe@')
password_strength('$securedpassword')
password_strength('.exestrongpassword')
password_strength('1 == 1')
password_strength('2345678')
[ ]
Return Value
3
4
65
75
25
90
265
50
130
100
55
165
1 def password_strength (password):
2
return 0 # DELETE THIS LINE and start coding here.
# Remember: end all of your functions with a return statement, not a print statement!
5
6 # Test cases.
7 print (password_strength('! Foo'))
8 print (password_strength('@#Okayz'))
9 print (password_strength('bGWp'))
10 print (password_strength('PPPPPP121k'))
11 print (password_strength('!123321strongpassword'))
12 print (password_strength('9hehe@'))
13 print
(password_strength('$securedpassword'))
14 print (password_strength('.exestrongpassword'))
15 print (password_strength('1 == 1'))
16 print (password_strength('2345678'))
Transcribed Image Text:Have you ever had the experience, while creating an account on a website, that a little meter pops up to tell you how "strong" your password is? Let's create our own version of that meter. Complete the 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 the password based on the location of certain characters in the string. The total at the end is a "score" that measures how strong the password is. Remember that you can use int() to convert a digit character into actual integer value. Points to Add +40 +30 +20 for each such digit +25 for each such digit +5 for each such lowercase letter +15 (in addition to the +5 from the previous rule) Rule the leftmost character is one of the symbols !, e, #, or $ the leftmost character is a digit an even digit anywhere but the leftmost position an odd digit anywhere but the leftmost position a lowercase letter anywhere the last character is a lowercase letter Examples: Function Call password_strength('! Foo') password_strength('@#Okayz ' ) password_strength('bGWp') password_strength ( 'PPPPPP121k') password_strength('!123321strongpassword') password_strength('9hehe@') password_strength('$securedpassword') password_strength('.exestrongpassword') password_strength('1 == 1') password_strength('2345678') [ ] Return Value 3 4 65 75 25 90 265 50 130 100 55 165 1 def password_strength (password): 2 return 0 # DELETE THIS LINE and start coding here. # Remember: end all of your functions with a return statement, not a print statement! 5 6 # Test cases. 7 print (password_strength('! Foo')) 8 print (password_strength('@#Okayz')) 9 print (password_strength('bGWp')) 10 print (password_strength('PPPPPP121k')) 11 print (password_strength('!123321strongpassword')) 12 print (password_strength('9hehe@')) 13 print (password_strength('$securedpassword')) 14 print (password_strength('.exestrongpassword')) 15 print (password_strength('1 == 1')) 16 print (password_strength('2345678'))
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Hiring Problem
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning