Write a function password_check() that takes as input two strings newpassword and oldpassword, and that accepts the new password (i.e., returns True) if newpassword is different from oldpassword and newpassword is at least 6 letters long. If the new password fails the check, your functions should return False. >>> password_check('E10-s2ff', 'E10.s2ff') True >>> password_check('E10sf', 'E10.s2ff') False >>> password_check('E10-s2ff', 'E10-s2ff') False (Extra Credit) For extra credit, extend your password function so that it also checks that the new password contains a digit. >>> password_check('E10-s2ff', 'E10.s2ff')     True >>> password_check('Eej-sdff', 'E10.s2ff') False

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section: Chapter Questions
Problem 1PP
icon
Related questions
Question
7. Write a function password_check() that takes as input two strings
newpassword and oldpassword, and that accepts the new password (i.e., returns
True) if newpassword is different from oldpassword and newpassword is at
least 6 letters long. If the new password fails the check, your functions should return
False.
>>> password_check('E10-s2ff', 'E10.s2ff')
True
>>> password_check('E10sf', 'E10.s2ff')
False
>>> password_check('E10-s2ff', 'E10-s2ff')
False
(Extra Credit) For extra credit, extend your password function so that it also checks that
the new password contains a digit.
>>> password_check('E10-s2ff', 'E10.s2ff')
 
 
True
>>> password_check('Eej-sdff', 'E10.s2ff')
False
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
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++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr