This program will be ran through a Python 3 IDE. Write a function password_check
ID: 3669497 • Letter: T
Question
This program will be ran through a Python 3 IDE.
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. 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)
a=len(newpassword)
b=len(oldpassword)
if b>6 and newpassword != oldpassword:
return true;
else:
return false;
password_check()
def main()
print password_check('E10-s2ff', 'E10.s2ff');
print password_check('E10sf', 'E10.s2ff');
print password_check('E10-s2ff', 'E10-s2ff');
main()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.