69.8k views
0 votes
Write a function password_check() that takes as input two strings newpassword and oldpassword, and 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

1 Answer

3 votes

In python:

def password_check(newpassword, oldpassword):

return True if newpassword != oldpassword and len(newpassword) >= 6 else False

Just for clarification, that return statement is on one line. I hope this helps!

User Safiyya
by
5.9k points