Write a python function password_check() that takes as input two strings newpass
ID: 3916010 • Letter: W
Question
Write a python 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 oldpasswordand newpassword is at least 6 letters long. If the new password fails the check, your functions should return False. Test your program by passing different values to the function as shown below.
Sample runs:
password_check('E10-s2ff', 'E10.s2ff')
True
password_check('E10sf', 'E10.s2ff')
False
password_check('E10-s2ff', 'E10-s2ff')
False
Explanation / Answer
def password_check(newpassword, oldpassword): return len(newpassword) >= 6 and newpassword != oldpassword print(password_check('E10-s2ff', 'E10.s2ff')) print(password_check('E10sf', 'E10.s2ff')) print(password_check('E10-s2ff', 'E10-s2ff'))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.